2008-02-27 20:56:47 +03:00
|
|
|
include(CheckIncludeFile)
|
|
|
|
include(CheckSymbolExists)
|
|
|
|
include(CheckFunctionExists)
|
|
|
|
include(CheckLibraryExists)
|
|
|
|
include(CheckTypeSize)
|
|
|
|
include(CheckCXXSourceCompiles)
|
|
|
|
|
|
|
|
set(PACKAGE ${APPLICATION_NAME})
|
|
|
|
set(VERSION ${APPLICATION_VERSION})
|
|
|
|
set(DATADIR ${DATA_INSTALL_DIR})
|
|
|
|
set(LIBDIR ${LIB_INSTALL_DIR})
|
2009-01-08 18:03:31 +03:00
|
|
|
set(PLUGINDIR "${PLUGIN_INSTALL_DIR}-${LIBRARY_SOVERSION}")
|
2008-05-07 17:33:55 +04:00
|
|
|
set(SYSCONFDIR ${SYSCONF_INSTALL_DIR})
|
|
|
|
|
2014-01-20 19:10:24 +04:00
|
|
|
set(BINARYDIR ${CMAKE_CURRENT_BINARY_DIR})
|
|
|
|
set(SOURCEDIR ${CMAKE_CURRENT_SOURCE_DIR})
|
2009-09-01 14:25:10 +04:00
|
|
|
|
2011-10-17 21:07:52 +04:00
|
|
|
# HEADER FILES
|
2012-10-16 12:37:40 +04:00
|
|
|
check_include_file(argp.h HAVE_ARGP_H)
|
2011-10-17 21:07:52 +04:00
|
|
|
|
2009-09-01 14:25:10 +04:00
|
|
|
# FUNCTIONS
|
2011-10-17 21:07:52 +04:00
|
|
|
if (NOT LINUX)
|
|
|
|
# librt
|
|
|
|
check_library_exists(rt nanosleep "" HAVE_LIBRT)
|
|
|
|
|
2012-04-13 23:48:39 +04:00
|
|
|
set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} )
|
2011-10-17 21:07:52 +04:00
|
|
|
endif (NOT LINUX)
|
|
|
|
|
|
|
|
check_library_exists(rt clock_gettime "" HAVE_CLOCK_GETTIME)
|
|
|
|
if (HAVE_LIBRT OR HAVE_CLOCK_GETTIME)
|
|
|
|
set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} rt)
|
|
|
|
endif (HAVE_LIBRT OR HAVE_CLOCK_GETTIME)
|
2009-09-01 14:25:10 +04:00
|
|
|
|
|
|
|
check_library_exists(dl dlopen "" HAVE_LIBDL)
|
|
|
|
if (HAVE_LIBDL)
|
2012-11-07 20:01:59 +04:00
|
|
|
set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} dl)
|
2009-09-01 14:25:10 +04:00
|
|
|
endif (HAVE_LIBDL)
|
|
|
|
|
2012-02-20 20:07:21 +04:00
|
|
|
check_function_exists(asprintf HAVE_ASPRINTF)
|
|
|
|
|
2012-03-02 17:54:53 +04:00
|
|
|
check_function_exists(fnmatch HAVE_FNMATCH)
|
|
|
|
if(NOT HAVE_FNMATCH AND WIN32)
|
|
|
|
find_library(SHLWAPI_LIBRARY shlwapi)
|
2012-11-07 20:01:59 +04:00
|
|
|
set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} shlwapi)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(WIN32)
|
|
|
|
set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} psapi kernel32)
|
2012-03-02 17:54:53 +04:00
|
|
|
endif()
|
|
|
|
|
2012-11-08 17:50:08 +04:00
|
|
|
check_function_exists(timegm HAVE_TIMEGM)
|
2012-02-20 21:23:31 +04:00
|
|
|
check_function_exists(strerror_r HAVE_STRERROR_R)
|
2012-02-20 20:11:13 +04:00
|
|
|
check_function_exists(utimes HAVE_UTIMES)
|
2012-02-20 21:27:23 +04:00
|
|
|
check_function_exists(lstat HAVE_LSTAT)
|
2012-10-18 17:07:17 +04:00
|
|
|
check_function_exists(asprintf HAVE_ASPRINTF)
|
2013-04-22 15:50:59 +04:00
|
|
|
if (WIN32)
|
|
|
|
check_function_exists(__mingw_asprintf HAVE___MINGW_ASPRINTF)
|
|
|
|
endif(WIN32)
|
2012-10-18 17:07:17 +04:00
|
|
|
if (UNIX AND HAVE_ASPRINTF)
|
2013-07-04 12:35:47 +04:00
|
|
|
add_definitions(-D_GNU_SOURCE)
|
2012-10-18 17:07:17 +04:00
|
|
|
endif (UNIX AND HAVE_ASPRINTF)
|
2013-07-04 12:35:47 +04:00
|
|
|
if (WIN32)
|
|
|
|
check_function_exists(__mingw_asprintf HAVE___MINGW_ASPRINTF)
|
|
|
|
endif(WIN32)
|
2012-02-20 21:27:23 +04:00
|
|
|
|
2013-07-04 12:13:18 +04:00
|
|
|
if (UNIT_TESTING)
|
|
|
|
set(WITH_UNIT_TESTING ON)
|
|
|
|
endif (UNIT_TESTING)
|
2012-02-20 21:27:23 +04:00
|
|
|
|
2009-09-01 14:25:10 +04:00
|
|
|
set(CSYNC_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} CACHE INTERNAL "csync required system libraries")
|