CMakeLists.txt 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
  2. PROJECT(PARADEVS CXX C)
  3. ENABLE_TESTING()
  4. SET(PARADEVS_MAJOR 1)
  5. SET(PARADEVS_MINOR 0)
  6. SET(PARADEVS_PATCH 0)
  7. SET(PARADEVS_EXTRA "")
  8. SET(PARADEVS_VERSION "${PARADEVS_MAJOR}.${PARADEVS_MINOR}.${PARADEVS_PATCH}")
  9. SET(PARADEVS_VERSION_SHORT "${PARADEVS_MAJOR}.${PARADEVS_MINOR}")
  10. SET(PARADEVS_NAME "paradevs")
  11. SET(PARADEVS_NAME_VERSION "${PARADEVS_NAME}-${PARADEVS_VERSION}")
  12. SET(PARADEVS_LOCALE_NAME "${PARADEVS_NAME}-${PARADEVS_MAJOR}-${PARADEVS_MINOR}")
  13. IF ("${PARADEVS_EXTRA}" STREQUAL "")
  14. SET(PARADEVS_COMPLETE "${PARADEVS_MAJOR}.${PARADEVS_MINOR}.${PARADEVS_PATCH}")
  15. ELSE ("${PARADEVS_EXTRA}" STREQUAL "")
  16. SET(PARADEVS_COMPLETE "${PARADEVS_MAJOR}.${PARADEVS_MINOR}.${PARADEVS_PATCH}-${PARADEVS_EXTRA}")
  17. ENDIF ("${PARADEVS_EXTRA}" STREQUAL "")
  18. SET(PARADEVS_NAME_COMPLETE "${PARADEVS_NAME}-${PARADEVS_COMPLETE}")
  19. #
  20. # Installation variables
  21. #
  22. SET(PARADEVS_LIBRARY_DIRS "lib/paradevs-${PARADEVS_VERSION_SHORT}")
  23. SET(PARADEVS_INCLUDE_DIRS "include/paradevs-${PARADEVS_VERSION_SHORT}/paradevs")
  24. SET(PARADEVS_INCLUDE_DIR "include/paradevs-${PARADEVS_VERSION_SHORT}")
  25. SET(PARADEVS_MANPAGE_PATH "share/man/man1")
  26. SET(PARADEVS_SHARE_DIRS "share/paradevs-${PARADEVS_VERSION_SHORT}")
  27. #
  28. # Append the library version information to the library target
  29. # properties.
  30. #
  31. SET (PARADEVS_LIBRARY_PROPERTIES VERSION 0)
  32. SET (PARADEVS_APP_PROPERTIES SOVERSION "${PARADEVS_MAJOR}.${PARADEVS_MINOR}"
  33. VERSION "${PARADEVS_MAJOR}.${PARADEVS_MINOR}")
  34. #
  35. # CPack configuration
  36. #
  37. INCLUDE(CMakeCPack.cmake)
  38. #
  39. # Debug mode
  40. #
  41. IF (CMAKE_COMPILER_IS_GNUCC AND CMAKE_COMPILER_IS_GNUCXX)
  42. SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra")
  43. SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -std=c++11 -pthread")
  44. IF (UNIX)
  45. SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pedantic")
  46. SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic")
  47. ENDIF (UNIX)
  48. ENDIF (CMAKE_COMPILER_IS_GNUCC AND CMAKE_COMPILER_IS_GNUCXX)
  49. if (CMAKE_BUILD_TYPE STREQUAL "")
  50. SET(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING "Choose the type of build" FORCE)
  51. endif ()
  52. #
  53. # Modules
  54. #
  55. INCLUDE(CheckIncludeFileCXX)
  56. INCLUDE(CheckIncludeFile)
  57. INCLUDE(CheckLibraryExists)
  58. INCLUDE(CMakeDetermineCCompiler)
  59. #
  60. # Test the libboost header and libboost-text library.
  61. #
  62. OPTION(WITH_TEST "use the libboost test unit library [default: on]" ON)
  63. SET(Boost_USE_MULTITHREADED ON)
  64. SET(Boost_USE_STATIC_LIBS OFF)
  65. SET(Boost_NO_SYSTEM_PATHS OFF)
  66. SET(Boost_USE_STATIC_RUNTIME ON)
  67. IF (WIN32)
  68. SET(Boost_THREADAPI "win32")
  69. ENDIF (WIN32)
  70. SET(Boost_DETAILED_FAILURE_MSG FALSE)
  71. SET(Boost_DEBUG FALSE)
  72. FIND_PACKAGE(Boost COMPONENTS graph mpi timer serialization system)
  73. IF (NOT Boost_GRAPH_FOUND)
  74. MESSAGE(FATAL_ERROR "The boost graph library is required")
  75. ENDIF (NOT Boost_GRAPH_FOUND)
  76. IF (Boost_MINOR_VERSION AND ${Boost_MINOR_VERSION} LESS "35")
  77. SET(Boost_SYSTEM_LIBRARY "")
  78. ENDIF (Boost_MINOR_VERSION AND ${Boost_MINOR_VERSION} LESS "35")
  79. IF (Boost_MINOR_VERSION AND ${Boost_MINOR_VERSION} LESS "41")
  80. SET(PARADEVS_HAVE_BOOST_SPIRIT2 0 CACHE INTERNAL "" FORCE)
  81. ELSE (Boost_MINOR_VERSION AND ${Boost_MINOR_VERSION} LESS "41")
  82. SET(PARADEVS_HAVE_BOOST_SPIRIT2 1 CACHE INTERNAL "" FORCE)
  83. ENDIF (Boost_MINOR_VERSION AND ${Boost_MINOR_VERSION} LESS "41")
  84. #
  85. # Generate the config.h
  86. #
  87. CHECK_INCLUDE_FILE_CXX(cxxabi.h PARADEVS_HAVE_GCC_ABI_DEMANGLE)
  88. CHECK_INCLUDE_FILE_CXX(execinfo.h PARADEVS_HAVE_EXECINFO)
  89. CHECK_INCLUDE_FILE_CXX(signal.h PARADEVS_HAVE_SIGNAL)
  90. INCLUDE_DIRECTORIES(${PARADEVS_BINARY_DIR})
  91. #
  92. # Generate the vle.pc pkg-config file.
  93. # Build some variable to build a correct Win32 pkg config file with:
  94. # prefix=/target to detect the DIRNAME
  95. # cflag=-Iboost_1_34_1 for the directory
  96. #
  97. SET(PARADEVS_PKGCONFIG_PREFIXPATH "${CMAKE_INSTALL_PREFIX}")
  98. SET(PARADEVS_PKGCONFIG_BOOSTINCLUDE_DIRS "${Boost_INCLUDE_DIRS}")
  99. SET(PARADEVS_PKGCONFIG_LIBDIR "lib")
  100. CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/src/paradevs.pc.in
  101. ${PARADEVS_BINARY_DIR}/paradevs-${PARADEVS_VERSION_SHORT}.pc @ONLY)
  102. INSTALL(FILES ${PARADEVS_BINARY_DIR}/paradevs-${PARADEVS_VERSION_SHORT}.pc
  103. DESTINATION lib/pkgconfig)
  104. #
  105. # Install the README
  106. #
  107. IF(UNIX)
  108. INSTALL(FILES "README" DESTINATION "${PARADEVS_SHARE_DIRS}")
  109. INSTALL(FILES "COPYING" DESTINATION "${PARADEVS_SHARE_DIRS}")
  110. ELSE(UNIX)
  111. INSTALL(FILES "README" DESTINATION "${PARADEVS_SHARE_DIRS}" RENAME "Readme.txt")
  112. INSTALL(FILES "COPYING" DESTINATION "${PARADEVS_SHARE_DIRS}" RENAME "CopyRight.txt")
  113. ENDIF(UNIX)
  114. #
  115. # Browse the src subdirectory
  116. #
  117. ADD_SUBDIRECTORY(src)
  118. #
  119. # Status
  120. #
  121. MESSAGE(STATUS "- - - -")
  122. MESSAGE(STATUS "${PARADEVS_NAME_COMPLETE} configured successfully")
  123. MESSAGE(STATUS "Using ${CMAKE_INSTALL_PREFIX} for installation")
  124. MESSAGE(STATUS "Build type ${CMAKE_BUILD_TYPE}")
  125. IF (PARADEVS_HAVE_GCC_ABI_DEMANGLE)
  126. MESSAGE(STATUS "Build with GCC ABI Demangle...: yes")
  127. ENDIF (PARADEVS_HAVE_GCC_ABI_DEMANGLE)
  128. IF (PARADEVS_HAVE_EXECINFO)
  129. MESSAGE(STATUS "Build with execinfo.h.........: yes")
  130. ENDIF (PARADEVS_HAVE_EXECINFO)
  131. IF (Boost_FOUND)
  132. MESSAGE(STATUS "Build with boost..............: yes")
  133. ENDIF (Boost_FOUND)
  134. MESSAGE(STATUS "- - - -")
  135. # vim:tw=0:ts=8:tw=0:sw=2:sts=2