CMakeLists.txt 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  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/vle-${PARADEVS_VERSION_SHORT}")
  23. SET(PARADEVS_INCLUDE_DIRS "include/vle-${PARADEVS_VERSION_SHORT}/vle")
  24. SET(PARADEVS_INCLUDE_DIR "include/vle-${PARADEVS_VERSION_SHORT}")
  25. SET(PARADEVS_MANPAGE_PATH "share/man/man1")
  26. SET(PARADEVS_SHARE_DIRS "share/vle-${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")
  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. # Check libraries with pkgconfig
  61. #
  62. FIND_PACKAGE(PkgConfig REQUIRED)
  63. # FIXME use old-style link directories for now
  64. IF (COMMAND CMAKE_POLICY)
  65. CMAKE_POLICY(SET CMP0003 OLD)
  66. ENDIF (COMMAND CMAKE_POLICY)
  67. PKG_CHECK_MODULES(GLIBMM REQUIRED glibmm-2.4)
  68. PKG_CHECK_MODULES(LIBXML REQUIRED libxml-2.0)
  69. #
  70. # Test the libboost header and libboost-text library.
  71. #
  72. OPTION(WITH_TEST "use the libboost test unit library [default: on]" ON)
  73. SET(Boost_USE_MULTITHREADED ON)
  74. SET(Boost_USE_STATIC_LIBS OFF)
  75. SET(Boost_NO_SYSTEM_PATHS OFF)
  76. SET(Boost_USE_STATIC_RUNTIME ON)
  77. IF (WIN32)
  78. SET(Boost_THREADAPI "win32")
  79. ENDIF (WIN32)
  80. SET(Boost_DETAILED_FAILURE_MSG FALSE)
  81. SET(Boost_DEBUG FALSE)
  82. FIND_PACKAGE(Boost COMPONENTS graph)
  83. IF (NOT Boost_GRAPH_FOUND)
  84. MESSAGE(FATAL_ERROR "The boost graph library is required")
  85. ENDIF (NOT Boost_GRAPH_FOUND)
  86. IF (Boost_MINOR_VERSION AND ${Boost_MINOR_VERSION} LESS "35")
  87. SET(Boost_SYSTEM_LIBRARY "")
  88. ENDIF (Boost_MINOR_VERSION AND ${Boost_MINOR_VERSION} LESS "35")
  89. IF (Boost_MINOR_VERSION AND ${Boost_MINOR_VERSION} LESS "41")
  90. SET(PARADEVS_HAVE_BOOST_SPIRIT2 0 CACHE INTERNAL "" FORCE)
  91. ELSE (Boost_MINOR_VERSION AND ${Boost_MINOR_VERSION} LESS "41")
  92. SET(PARADEVS_HAVE_BOOST_SPIRIT2 1 CACHE INTERNAL "" FORCE)
  93. ENDIF (Boost_MINOR_VERSION AND ${Boost_MINOR_VERSION} LESS "41")
  94. #
  95. # Generate the config.h
  96. #
  97. CHECK_INCLUDE_FILE_CXX(cxxabi.h PARADEVS_HAVE_GCC_ABI_DEMANGLE)
  98. CHECK_INCLUDE_FILE_CXX(execinfo.h PARADEVS_HAVE_EXECINFO)
  99. CHECK_INCLUDE_FILE_CXX(signal.h PARADEVS_HAVE_SIGNAL)
  100. INCLUDE_DIRECTORIES(${PARADEVS_BINARY_DIR})
  101. #
  102. # Generate the vle.pc pkg-config file.
  103. # Build some variable to build a correct Win32 pkg config file with:
  104. # prefix=/target to detect the DIRNAME
  105. # cflag=-Iboost_1_34_1 for the directory
  106. #
  107. SET(PARADEVS_PKGCONFIG_PREFIXPATH "${CMAKE_INSTALL_PREFIX}")
  108. SET(PARADEVS_PKGCONFIG_BOOSTINCLUDE_DIRS "${Boost_INCLUDE_DIRS}")
  109. SET(PARADEVS_PKGCONFIG_LIBDIR "lib")
  110. CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/src/paradevs.pc.in
  111. ${PARADEVS_BINARY_DIR}/paradevs-${PARADEVS_VERSION_SHORT}.pc @ONLY)
  112. INSTALL(FILES ${PARADEVS_BINARY_DIR}/paradevs-${PARADEVS_VERSION_SHORT}.pc
  113. DESTINATION lib/pkgconfig)
  114. #
  115. # Install the README
  116. #
  117. IF(UNIX)
  118. INSTALL(FILES "README" DESTINATION "${PARADEVS_SHARE_DIRS}")
  119. INSTALL(FILES "COPYING" DESTINATION "${PARADEVS_SHARE_DIRS}")
  120. ELSE(UNIX)
  121. INSTALL(FILES "README" DESTINATION "${PARADEVS_SHARE_DIRS}" RENAME "Readme.txt")
  122. INSTALL(FILES "COPYING" DESTINATION "${PARADEVS_SHARE_DIRS}" RENAME "CopyRight.txt")
  123. ENDIF(UNIX)
  124. #
  125. # Browse the src subdirectory
  126. #
  127. ADD_SUBDIRECTORY(src)
  128. #
  129. # Status
  130. #
  131. MESSAGE(STATUS "- - - -")
  132. MESSAGE(STATUS "${PARADEVS_NAME_COMPLETE} configured successfully")
  133. MESSAGE(STATUS "Using ${CMAKE_INSTALL_PREFIX} for installation")
  134. MESSAGE(STATUS "Build type ${CMAKE_BUILD_TYPE}")
  135. IF (PARADEVS_HAVE_GCC_ABI_DEMANGLE)
  136. MESSAGE(STATUS "Build with GCC ABI Demangle...: yes")
  137. ENDIF (PARADEVS_HAVE_GCC_ABI_DEMANGLE)
  138. IF (PARADEVS_HAVE_EXECINFO)
  139. MESSAGE(STATUS "Build with execinfo.h.........: yes")
  140. ENDIF (PARADEVS_HAVE_EXECINFO)
  141. IF (Boost_FOUND)
  142. MESSAGE(STATUS "Build with boost..............: yes")
  143. ENDIF (Boost_FOUND)
  144. MESSAGE(STATUS "- - - -")
  145. # vim:tw=0:ts=8:tw=0:sw=2:sts=2