ConfigureChecks.cmake 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. include(CheckIncludeFile)
  2. include(CheckSymbolExists)
  3. include(CheckFunctionExists)
  4. include(CheckLibraryExists)
  5. include(CheckTypeSize)
  6. include(CheckCXXSourceCompiles)
  7. set(PACKAGE ${APPLICATION_NAME})
  8. set(VERSION ${APPLICATION_VERSION})
  9. set(DATADIR ${DATA_INSTALL_DIR})
  10. set(LIBDIR ${LIB_INSTALL_DIR})
  11. set(PLUGINDIR "${PLUGIN_INSTALL_DIR}-${LIBRARY_SOVERSION}")
  12. set(SYSCONFDIR ${SYSCONF_INSTALL_DIR})
  13. set(BINARYDIR ${CMAKE_CURRENT_BINARY_DIR})
  14. set(SOURCEDIR ${CMAKE_CURRENT_SOURCE_DIR})
  15. # HEADER FILES
  16. check_include_file(argp.h HAVE_ARGP_H)
  17. # FUNCTIONS
  18. if (NOT LINUX)
  19. # librt
  20. check_library_exists(rt nanosleep "" HAVE_LIBRT)
  21. set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} )
  22. endif (NOT LINUX)
  23. check_library_exists(rt clock_gettime "" HAVE_CLOCK_GETTIME)
  24. if (HAVE_LIBRT OR HAVE_CLOCK_GETTIME)
  25. set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} rt)
  26. endif (HAVE_LIBRT OR HAVE_CLOCK_GETTIME)
  27. check_library_exists(dl dlopen "" HAVE_LIBDL)
  28. if (HAVE_LIBDL)
  29. set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} dl)
  30. endif (HAVE_LIBDL)
  31. check_function_exists(asprintf HAVE_ASPRINTF)
  32. check_function_exists(fnmatch HAVE_FNMATCH)
  33. if(NOT HAVE_FNMATCH AND WIN32)
  34. find_library(SHLWAPI_LIBRARY shlwapi)
  35. set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} shlwapi)
  36. endif()
  37. if(WIN32)
  38. set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} psapi kernel32)
  39. endif()
  40. check_function_exists(timegm HAVE_TIMEGM)
  41. check_function_exists(strerror_r HAVE_STRERROR_R)
  42. check_function_exists(utimes HAVE_UTIMES)
  43. check_function_exists(lstat HAVE_LSTAT)
  44. check_function_exists(asprintf HAVE_ASPRINTF)
  45. if (WIN32)
  46. check_function_exists(__mingw_asprintf HAVE___MINGW_ASPRINTF)
  47. endif(WIN32)
  48. if (UNIX AND HAVE_ASPRINTF)
  49. add_definitions(-D_GNU_SOURCE)
  50. endif (UNIX AND HAVE_ASPRINTF)
  51. if (WIN32)
  52. check_function_exists(__mingw_asprintf HAVE___MINGW_ASPRINTF)
  53. endif(WIN32)
  54. if (UNIT_TESTING)
  55. set(WITH_UNIT_TESTING ON)
  56. endif (UNIT_TESTING)
  57. set(CSYNC_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} CACHE INTERNAL "csync required system libraries")