ConfigureChecks.cmake 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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(SYSCONFDIR ${SYSCONF_INSTALL_DIR})
  12. set(BINARYDIR ${CMAKE_CURRENT_BINARY_DIR})
  13. set(SOURCEDIR ${CMAKE_CURRENT_SOURCE_DIR})
  14. # HEADER FILES
  15. check_include_file(argp.h HAVE_ARGP_H)
  16. # FUNCTIONS
  17. if (NOT LINUX)
  18. # librt
  19. check_library_exists(rt nanosleep "" HAVE_LIBRT)
  20. set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} )
  21. endif (NOT LINUX)
  22. check_library_exists(rt clock_gettime "" HAVE_CLOCK_GETTIME)
  23. if (HAVE_LIBRT OR HAVE_CLOCK_GETTIME)
  24. set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} rt)
  25. endif (HAVE_LIBRT OR HAVE_CLOCK_GETTIME)
  26. check_library_exists(dl dlopen "" HAVE_LIBDL)
  27. if (HAVE_LIBDL)
  28. set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} dl)
  29. endif (HAVE_LIBDL)
  30. check_function_exists(asprintf HAVE_ASPRINTF)
  31. check_function_exists(fnmatch HAVE_FNMATCH)
  32. if(NOT HAVE_FNMATCH AND WIN32)
  33. find_library(SHLWAPI_LIBRARY shlwapi)
  34. set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} shlwapi)
  35. endif()
  36. if(WIN32)
  37. set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} psapi kernel32)
  38. endif()
  39. check_function_exists(timegm HAVE_TIMEGM)
  40. check_function_exists(strerror_r HAVE_STRERROR_R)
  41. check_function_exists(utimes HAVE_UTIMES)
  42. check_function_exists(lstat HAVE_LSTAT)
  43. check_function_exists(asprintf HAVE_ASPRINTF)
  44. if (WIN32)
  45. check_function_exists(__mingw_asprintf HAVE___MINGW_ASPRINTF)
  46. endif(WIN32)
  47. if (UNIX AND HAVE_ASPRINTF)
  48. add_definitions(-D_GNU_SOURCE)
  49. endif (UNIX AND HAVE_ASPRINTF)
  50. if (WIN32)
  51. check_function_exists(__mingw_asprintf HAVE___MINGW_ASPRINTF)
  52. endif(WIN32)
  53. set(CSYNC_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} CACHE INTERNAL "csync required system libraries")