CMakeLists.txt 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247
  1. ##########################################################################
  2. # CMake Build Rules for Boost #
  3. ##########################################################################
  4. # Copyright (C) 2007, 2008 Douglas Gregor <doug.gregor@gmail.com> #
  5. # Copyright (C) 2007 Troy Straszheim #
  6. # #
  7. # Distributed under the Boost Software License, Version 1.0. #
  8. # See accompanying file LICENSE_1_0.txt or copy at #
  9. # http://www.boost.org/LICENSE_1_0.txt #
  10. ##########################################################################
  11. # Basic Usage: #
  12. # #
  13. # On Unix variants: #
  14. # ccmake BOOST_DIRECTORY #
  15. # #
  16. # (c)onfigure options to your liking, then (g)enerate #
  17. # makefiles. Use "make" to build, "make test" to test, "make #
  18. # install" to install, and "make package" to build binary #
  19. # packages. #
  20. # #
  21. # On Windows: #
  22. # run the CMake GNU, load the Boost directory, and generate #
  23. # project files or makefiles for your environment. #
  24. # #
  25. # For more information about CMake, see http://www.cmake.org #
  26. ##########################################################################
  27. cmake_minimum_required(VERSION 2.6.0 FATAL_ERROR)
  28. project(Boost)
  29. ##########################################################################
  30. # Post a warning to those attempting to use the CMake Build system. When #
  31. # the build system stabilizes this can be removed. #
  32. ##########################################################################
  33. message(STATUS "##########################################################################")
  34. message(STATUS " THE CMAKE BUILD SYSTEM IS CURRENTLY UNDER DEVELOPMENT. PLEASE USE THE ")
  35. message(STATUS " BJAM BASED SYSTEM INSTEAD. IF YOU STILL WANT TO TRY IT OUT PLEASE COMMENT")
  36. message(STATUS " OUT THE LINE 'message(FATAL_ERROR \"\")' THAT APPEARS IN THE FILE ")
  37. message(STATUS " ${Boost_SOURCE_DIR}/CMakeLists.txt FILE.")
  38. message(STATUS "##########################################################################")
  39. #message(FATAL_ERROR "")
  40. ##########################################################################
  41. # Version information #
  42. ##########################################################################
  43. set(BOOST_VERSION_MAJOR 1)
  44. set(BOOST_VERSION_MINOR 37)
  45. set(BOOST_VERSION_SUBMINOR 0)
  46. set(BOOST_VERSION "${BOOST_VERSION_MAJOR}.${BOOST_VERSION_MINOR}.${BOOST_VERSION_SUBMINOR}")
  47. ##########################################################################
  48. # Put the libaries and binaries that get built into directories at the
  49. # top of the build tree rather than in hard-to-find leaf
  50. # directories. This simplifies manual testing and the use of the build
  51. # tree rather than installed Boost libraries.
  52. SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
  53. SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
  54. if (FALSE)
  55. # ---------- Setup output Directories -------------------------
  56. SET (LIBRARY_OUTPUT_PATH
  57. ${PROJECT_BINARY_DIR}/lib
  58. CACHE PATH
  59. "Directory for all Libraries"
  60. )
  61. # --------- Setup the Executable output Directory -------------
  62. SET (EXECUTABLE_OUTPUT_PATH
  63. ${PROJECT_BINARY_DIR}/bin
  64. CACHE PATH
  65. "Directory for all Executables."
  66. )
  67. endif(FALSE)
  68. ##########################################################################
  69. # Boost CMake modules #
  70. ##########################################################################
  71. list(APPEND CMAKE_MODULE_PATH ${Boost_SOURCE_DIR}/tools/build/CMake)
  72. include(BoostUtils)
  73. include(BoostConfig)
  74. include(BoostBuildSlave)
  75. include(BoostCore)
  76. include(BoostDocs)
  77. include(BoostTesting)
  78. ##########################################################################
  79. ##########################################################################
  80. # Build Features and Variants #
  81. ##########################################################################
  82. # Determine default settings for the variable BUILD_feature options
  83. if (MSVC)
  84. set(BUILD_SINGLE_THREADED_DEFAULT OFF)
  85. else ()
  86. set(BUILD_SINGLE_THREADED_DEFAULT OFF)
  87. endif ()
  88. # User-level options deciding which variants we will build.
  89. option(BUILD_STATIC "Whether to build static libraries" ON)
  90. option(BUILD_SHARED "Whether to build shared libraries" ON)
  91. option(BUILD_DEBUG "Whether to build debugging libraries" ON)
  92. option(BUILD_RELEASE "Whether to build release libraries" ON)
  93. option(BUILD_SINGLE_THREADED "Whether to build single-threaded libraries"
  94. ${BUILD_SINGLE_THREADED_DEFAULT})
  95. option(BUILD_MULTI_THREADED "Whether to build multi-threaded libraries" ON)
  96. # For now, we only actually support static/dynamic run-time variants for
  97. # Visual C++. Provide both options for Visual C++ users, but just fix
  98. # the values of the variables for all other platforms.
  99. if(MSVC)
  100. option(BUILD_STATIC_RUNTIME "Whether to build libraries linking against the static runtime" ON)
  101. option(BUILD_DYNAMIC_RUNTIME "Whether to build libraries linking against the dynamic runtime" ON)
  102. else(MSVC)
  103. set(BUILD_STATIC_RUNTIME OFF)
  104. set(BUILD_DYNAMIC_RUNTIME ON)
  105. endif(MSVC)
  106. # The default set of library variants that we will be building
  107. boost_add_default_variant(RELEASE DEBUG)
  108. boost_add_default_variant(STATIC SHARED)
  109. boost_add_default_variant(SINGLE_THREADED MULTI_THREADED)
  110. boost_add_default_variant(DYNAMIC_RUNTIME STATIC_RUNTIME)
  111. # Extra features used by some libraries
  112. set(BUILD_PYTHON_NODEBUG ON)
  113. boost_add_extra_variant(PYTHON_NODEBUG PYTHON_DEBUG)
  114. ##########################################################################
  115. ##########################################################################
  116. # Installation #
  117. ##########################################################################
  118. if(BOOST_VERSION_SUBMINOR GREATER 0)
  119. set(BOOST_HEADER_DIR
  120. "include/boost-${BOOST_VERSION_MAJOR}_${BOOST_VERSION_MINOR}_${BOOST_VERSION_SUBMINOR}")
  121. else(BOOST_VERSION_SUBMINOR GREATER 0)
  122. set(BOOST_HEADER_DIR
  123. "include/boost-${BOOST_VERSION_MAJOR}_${BOOST_VERSION_MINOR}")
  124. endif(BOOST_VERSION_SUBMINOR GREATER 0)
  125. install(DIRECTORY boost
  126. DESTINATION ${BOOST_HEADER_DIR}
  127. PATTERN "CVS" EXCLUDE
  128. PATTERN ".svn" EXCLUDE)
  129. #
  130. # TDS 20080526: Getting a segfault here even with the ifs. At r45780, with these lines
  131. # uncommented:
  132. # 1. cmake the workspace
  133. # 2. run ccmake and turn OFF BUILD_MULTI_THREADED and BUILD_SHARED
  134. # 3. 'c' to configure
  135. # 4. 'g' to generate.... segfault.
  136. # 5. run rebuild_cache at the command line: no segfault this time.
  137. #
  138. # With these lines commented out, step 4 above does not segfault.
  139. #
  140. #if (NOT TEST_INSTALLED_TREE)
  141. # If I don't have if around this, I get a seg fault
  142. # install(EXPORT boost-targets DESTINATION "lib/Boost${BOOST_VERSION}")
  143. #endif (NOT TEST_INSTALLED_TREE)
  144. ##########################################################################
  145. ##########################################################################
  146. # Binary packages #
  147. ##########################################################################
  148. set(CPACK_PACKAGE_NAME "Boost")
  149. set(CPACK_PACKAGE_VENDOR "Boost.org")
  150. set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Boost ${BOOST_VERSION}")
  151. set(CPACK_PACKAGE_DESCRIPTION_FILE "${Boost_SOURCE_DIR}/README.txt")
  152. set(CPACK_RESOURCE_FILE_README "${Boost_SOURCE_DIR}/README.txt")
  153. set(CPACK_RESOURCE_FILE_LICENSE "${Boost_SOURCE_DIR}/LICENSE_1_0.txt")
  154. set(CPACK_RESOURCE_FILE_WELCOME "${Boost_SOURCE_DIR}/Welcome.txt")
  155. set(CPACK_PACKAGE_VERSION "${BOOST_VERSION}")
  156. set(CPACK_PACKAGE_VERSION_MAJOR "${BOOST_VERSION_MAJOR}")
  157. set(CPACK_PACKAGE_VERSION_MINOR "${BOOST_VERSION_MINOR}")
  158. set(CPACK_PACKAGE_VERSION_PATCH "${BOOST_VERSION_SUBMINOR}")
  159. set(CPACK_PACKAGE_INSTALL_DIRECTORY "Boost")
  160. if(WIN32 AND NOT UNIX)
  161. # There is a bug in NSI that does not handle full unix paths properly. Make
  162. # sure there is at least one set of four (4) backlasshes.
  163. # NOTE: No Boost icon yet
  164. # set(CPACK_PACKAGE_ICON "${Boost_SOURCE_DIR}/tools/build/CMake\\\\InstallIcon.bmp")
  165. # set(CPACK_NSIS_INSTALLED_ICON_NAME "bin\\\\MyExecutable.exe")
  166. set(CPACK_NSIS_DISPLAY_NAME "Boost ${BOOST_VERSION_MAJOR}.${BOOST_VERSION_MINOR}.${BOOST_VERSION_SUBMINOR}")
  167. set(CPACK_NSIS_HELP_LINK "http:\\\\\\\\www.boost.org")
  168. set(CPACK_NSIS_URL_INFO_ABOUT "http:\\\\\\\\www.boost.org")
  169. set(CPACK_NSIS_CONTACT "boost-users@lists.boost.org")
  170. set(CPACK_NSIS_MODIFY_PATH ON)
  171. # Encode the compiler name in the package
  172. if (MSVC60)
  173. set(CPACK_PACKAGE_FILE_NAME "Boost-${BOOST_VERSION}-vc6")
  174. set(CPACK_NSIS_DISPLAY_NAME "${CPACK_NSIS_DISPLAY_NAME} for Microsoft Visual C++ 6")
  175. elseif (MSVC70)
  176. set(CPACK_PACKAGE_FILE_NAME "Boost-${BOOST_VERSION}-vc7")
  177. set(CPACK_NSIS_DISPLAY_NAME "${CPACK_NSIS_DISPLAY_NAME} for Microsoft Visual Studio 2002")
  178. elseif (MSVC71)
  179. set(CPACK_PACKAGE_FILE_NAME "Boost-${BOOST_VERSION}-vc71")
  180. set(CPACK_NSIS_DISPLAY_NAME "${CPACK_NSIS_DISPLAY_NAME} for Microsoft Visual Studio 2003")
  181. elseif (MSVC80)
  182. set(CPACK_PACKAGE_FILE_NAME "Boost-${BOOST_VERSION}-vc8")
  183. set(CPACK_NSIS_DISPLAY_NAME "${CPACK_NSIS_DISPLAY_NAME} for Microsoft Visual Studio 2005")
  184. elseif (MSVC90)
  185. set(CPACK_PACKAGE_FILE_NAME "Boost-${BOOST_VERSION}-vc9")
  186. set(CPACK_NSIS_DISPLAY_NAME "${CPACK_NSIS_DISPLAY_NAME} for Microsoft Visual Studio 2008")
  187. elseif (BORLAND)
  188. set(CPACK_PACKAGE_FILE_NAME "Boost-${BOOST_VERSION}-borland")
  189. set(CPACK_NSIS_DISPLAY_NAME "${CPACK_NSIS_DISPLAY_NAME} for Borland C++ Builder")
  190. endif (MSVC60)
  191. set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "${CPACK_NSIS_DISPLAY_NAME}")
  192. endif(WIN32 AND NOT UNIX)
  193. include(CPack)
  194. if(COMMAND cpack_configure_downloads)
  195. cpack_configure_downloads(
  196. "http://www.osl.iu.edu/~dgregor/Boost-CMake/1.36.0/"
  197. ALL ADD_REMOVE)
  198. endif()
  199. ##########################################################################
  200. ##########################################################################
  201. # Building Boost libraries #
  202. ##########################################################################
  203. # Always include the directory where Boost's include files will be.
  204. if (TEST_INSTALLED_TREE)
  205. # Use the headers from the installation directory
  206. include_directories("${CMAKE_INSTALL_PREFIX}/${BOOST_HEADER_DIR}")
  207. else (TEST_INSTALLED_TREE)
  208. # Use the headers directly from the Boost source tree (in boost/)
  209. include_directories(${Boost_SOURCE_DIR})
  210. endif (TEST_INSTALLED_TREE)
  211. # Boost.Build version 2 does this due to trouble with autolinking
  212. # during building and testing.
  213. # TODO: See if we can actually use auto-linking in our regression tests.
  214. add_definitions(-DBOOST_ALL_NO_LIB=1)
  215. # Add build rules for documentation
  216. add_subdirectory(doc)
  217. # Add build rules for all of the Boost libraries
  218. add_subdirectory(${BOOST_LIBS_DIR})
  219. # Add build rules for all of the Boost tools
  220. # TODO: On hold while I work on the modularity code
  221. add_subdirectory(tools)
  222. ##########################################################################
粤ICP备19079148号