CMakeLists.txt 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
  2. PROJECT(PARADEVS_TEST CXX C)
  3. ENABLE_TESTING()
  4. SET(MODEL_MAJOR 0)
  5. SET(MODEL_MINOR 1)
  6. SET(MODEL_PATCH 0)
  7. SET(MODEL_EXTRA "-dev")
  8. IF ("${MODEL_EXTRA}" STREQUAL "")
  9. SET(MODEL_NAME "${PROJECT_NAME}-${MODEL_MAJOR}.${MODEL_MINOR}.${MODEL_PATCH}")
  10. ELSE ("${MODEL_EXTRA}" STREQUAL "")
  11. SET(MODEL_NAME "${PROJECT_NAME}-${MODEL_MAJOR}.${MODEL_MINOR}.${MODEL_PATCH}${MODEL_EXTRA}")
  12. ENDIF ("${MODEL_EXTRA}" STREQUAL "")
  13. #
  14. # CPack configuration
  15. #
  16. INCLUDE(CMakeCPack.cmake)
  17. #
  18. # Debug mode
  19. #
  20. IF (CMAKE_COMPILER_IS_GNUCC AND CMAKE_COMPILER_IS_GNUCXX)
  21. SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra")
  22. SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -std=c++11 -pthread")
  23. IF (UNIX)
  24. SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pedantic")
  25. SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic")
  26. ENDIF (UNIX)
  27. ENDIF (CMAKE_COMPILER_IS_GNUCC AND CMAKE_COMPILER_IS_GNUCXX)
  28. if (CMAKE_BUILD_TYPE STREQUAL "")
  29. SET(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING "Choose the type of build" FORCE)
  30. endif ()
  31. #
  32. # Modules
  33. #
  34. INCLUDE(CheckIncludeFileCXX)
  35. INCLUDE(CheckIncludeFile)
  36. INCLUDE(CheckLibraryExists)
  37. INCLUDE(CMakeDetermineCCompiler)
  38. #
  39. # Check libraries with pkgconfig
  40. #
  41. FIND_PACKAGE(PkgConfig REQUIRED)
  42. # FIXME use old-style link directories for now
  43. IF (COMMAND CMAKE_POLICY)
  44. CMAKE_POLICY(SET CMP0003 OLD)
  45. ENDIF (COMMAND CMAKE_POLICY)
  46. PKG_CHECK_MODULES(PARADEVS REQUIRED paradevs-1.0)
  47. PKG_CHECK_MODULES(LIBXML REQUIRED libxml-2.0)
  48. #
  49. # Test the libboost header and libboost-text library.
  50. #
  51. OPTION(WITH_TEST "use the libboost test unit library [default: on]" ON)
  52. SET(Boost_USE_MULTITHREADED ON)
  53. SET(Boost_USE_STATIC_LIBS OFF)
  54. SET(Boost_NO_SYSTEM_PATHS OFF)
  55. SET(Boost_USE_STATIC_RUNTIME ON)
  56. IF (WIN32)
  57. SET(Boost_THREADAPI "win32")
  58. ENDIF (WIN32)
  59. SET(Boost_DETAILED_FAILURE_MSG FALSE)
  60. SET(Boost_DEBUG FALSE)
  61. FIND_PACKAGE(Boost COMPONENTS graph timer system)
  62. IF (NOT Boost_GRAPH_FOUND)
  63. MESSAGE(FATAL_ERROR "The boost graph library is required")
  64. ENDIF (NOT Boost_GRAPH_FOUND)
  65. IF (Boost_MINOR_VERSION AND ${Boost_MINOR_VERSION} LESS "35")
  66. SET(Boost_SYSTEM_LIBRARY "")
  67. ENDIF (Boost_MINOR_VERSION AND ${Boost_MINOR_VERSION} LESS "35")
  68. IF (Boost_MINOR_VERSION AND ${Boost_MINOR_VERSION} LESS "41")
  69. SET(PARADEVS_HAVE_BOOST_SPIRIT2 0 CACHE INTERNAL "" FORCE)
  70. ELSE (Boost_MINOR_VERSION AND ${Boost_MINOR_VERSION} LESS "41")
  71. SET(PARADEVS_HAVE_BOOST_SPIRIT2 1 CACHE INTERNAL "" FORCE)
  72. ENDIF (Boost_MINOR_VERSION AND ${Boost_MINOR_VERSION} LESS "41")
  73. #
  74. # Generate the config.h
  75. #
  76. CHECK_INCLUDE_FILE_CXX(cxxabi.h PARADEVS_HAVE_GCC_ABI_DEMANGLE)
  77. CHECK_INCLUDE_FILE_CXX(execinfo.h PARADEVS_HAVE_EXECINFO)
  78. CHECK_INCLUDE_FILE_CXX(signal.h PARADEVS_HAVE_SIGNAL)
  79. INCLUDE_DIRECTORIES(${PARADEVS_BINARY_DIR})
  80. #
  81. # Browse the src subdirectory
  82. #
  83. ADD_SUBDIRECTORY(src)
  84. #
  85. # Status
  86. #
  87. MESSAGE(STATUS "- - - -")
  88. MESSAGE(STATUS "${PARADEVS_NAME_COMPLETE} configured successfully")
  89. MESSAGE(STATUS "Using ${CMAKE_INSTALL_PREFIX} for installation")
  90. MESSAGE(STATUS "Build type ${CMAKE_BUILD_TYPE}")
  91. IF (PARADEVS_HAVE_GCC_ABI_DEMANGLE)
  92. MESSAGE(STATUS "Build with GCC ABI Demangle...: yes")
  93. ENDIF (PARADEVS_HAVE_GCC_ABI_DEMANGLE)
  94. IF (PARADEVS_HAVE_EXECINFO)
  95. MESSAGE(STATUS "Build with execinfo.h.........: yes")
  96. ENDIF (PARADEVS_HAVE_EXECINFO)
  97. IF (Boost_FOUND)
  98. MESSAGE(STATUS "Build with boost..............: yes")
  99. ENDIF (Boost_FOUND)
  100. MESSAGE(STATUS "- - - -")
  101. # vim:tw=0:ts=8:tw=0:sw=2:sts=2