diff options
author | Troy D. Straszheim <troy@resophonic.com> | 2009-01-24 18:57:20 +0000 |
---|---|---|
committer | Troy D. Straszheim <troy@resophonic.com> | 2009-01-24 18:57:20 +0000 |
commit | a0a37bc6333acd48cf869caf0afd46a44b2abfb8 (patch) | |
tree | d096bc4f44ba13b66a6c5e48e18635dd87f31483 /CMakeLists.txt | |
parent | b905fdb8aff4b0175cf842c531e73162aa5acd0d (diff) | |
download | boost-a0a37bc6333acd48cf869caf0afd46a44b2abfb8.tar.gz |
merge of cmake build files from trunk per beman
[SVN r50756]
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 243 |
1 files changed, 243 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000000..711cc54986 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,243 @@ +########################################################################## +# CMake Build Rules for Boost # +########################################################################## +# Copyright (C) 2007, 2008 Douglas Gregor <doug.gregor@gmail.com> # +# Copyright (C) 2007 Troy Straszheim # +# # +# Distributed under the Boost Software License, Version 1.0. # +# See accompanying file LICENSE_1_0.txt or copy at # +# http://www.boost.org/LICENSE_1_0.txt # +########################################################################## +# Basic Usage: # +# # +# On Unix variants: # +# ccmake BOOST_DIRECTORY # +# # +# (c)onfigure options to your liking, then (g)enerate # +# makefiles. Use "make" to build, "make test" to test, "make # +# install" to install, and "make package" to build binary # +# packages. # +# # +# On Windows: # +# run the CMake GNU, load the Boost directory, and generate # +# project files or makefiles for your environment. # +# # +# For more information about CMake, see http://www.cmake.org # +########################################################################## +cmake_minimum_required(VERSION 2.6.0 FATAL_ERROR) +project(Boost) + + +########################################################################## +# Post a warning to those attempting to use the CMake Build system. When # +# the build system stabilizes this can be removed. # +########################################################################## +if (NOT CMAKE_IS_EXPERIMENTAL) +message(STATUS "##########################################################################") +message(STATUS " THE CMAKE BUILD SYSTEM IS CURRENTLY UNDER DEVELOPMENT. PLEASE USE THE ") +message(STATUS " BJAM BASED SYSTEM INSTEAD TO BUILD A PRODUCTION VERSION OF BOOST. IF YOU ") +message(STATUS " STILL WANT TO TRY IT OUT INVOKE CMake WITH '-DCMAKE_IS_EXPERIMENTAL=TRUE'") +message(STATUS " ARGUMENT. After this first run of cmake you will no longer have to supply") +message(STATUS " the argument unless you need to run a cmake on a clean build directory.") +message(STATUS "##########################################################################") +message(FATAL_ERROR "") +endif (NOT CMAKE_IS_EXPERIMENTAL) + +########################################################################## +# Version information # +########################################################################## +set(BOOST_VERSION_MAJOR 1) +set(BOOST_VERSION_MINOR 38) +set(BOOST_VERSION_SUBMINOR 0) +set(BOOST_VERSION "${BOOST_VERSION_MAJOR}.${BOOST_VERSION_MINOR}.${BOOST_VERSION_SUBMINOR}") +########################################################################## + +# Put the libaries and binaries that get built into directories at the +# top of the build tree rather than in hard-to-find leaf +# directories. This simplifies manual testing and the use of the build +# tree rather than installed Boost libraries. +SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) +SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) +SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) + +########################################################################## +# Boost CMake modules # +########################################################################## +list(APPEND CMAKE_MODULE_PATH ${Boost_SOURCE_DIR}/tools/build/CMake) +include(BoostUtils) +include(BoostConfig) +include(BoostBuildSlave) +include(BoostCore) +include(BoostDocs) +include(BoostTesting) +########################################################################## + +########################################################################## +# Build Features and Variants # +########################################################################## + +# Determine default settings for the variable BUILD_feature options +if (MSVC) + set(BUILD_SINGLE_THREADED_DEFAULT OFF) +else () + set(BUILD_SINGLE_THREADED_DEFAULT OFF) +endif () + +# User-level options deciding which variants we will build. +option(BUILD_STATIC "Whether to build static libraries" ON) +option(BUILD_SHARED "Whether to build shared libraries" ON) +option(BUILD_DEBUG "Whether to build debugging libraries" ON) +option(BUILD_RELEASE "Whether to build release libraries" ON) +option(BUILD_SINGLE_THREADED "Whether to build single-threaded libraries" + ${BUILD_SINGLE_THREADED_DEFAULT}) +option(BUILD_MULTI_THREADED "Whether to build multi-threaded libraries" ON) + +# For now, we only actually support static/dynamic run-time variants for +# Visual C++. Provide both options for Visual C++ users, but just fix +# the values of the variables for all other platforms. +if(MSVC) + option(BUILD_STATIC_RUNTIME "Whether to build libraries linking against the static runtime" ON) + option(BUILD_DYNAMIC_RUNTIME "Whether to build libraries linking against the dynamic runtime" ON) +else(MSVC) + set(BUILD_STATIC_RUNTIME OFF) + set(BUILD_DYNAMIC_RUNTIME ON) +endif(MSVC) + +# The default set of library variants that we will be building +boost_add_default_variant(RELEASE DEBUG) +boost_add_default_variant(STATIC SHARED) +boost_add_default_variant(SINGLE_THREADED MULTI_THREADED) +boost_add_default_variant(DYNAMIC_RUNTIME STATIC_RUNTIME) + +# Extra features used by some libraries +set(BUILD_PYTHON_NODEBUG ON) +boost_add_extra_variant(PYTHON_NODEBUG PYTHON_DEBUG) +########################################################################## + +########################################################################## +# Installation # +########################################################################## +if(BOOST_VERSION_SUBMINOR GREATER 0) + set(BOOST_HEADER_DIR + "include/boost-${BOOST_VERSION_MAJOR}_${BOOST_VERSION_MINOR}_${BOOST_VERSION_SUBMINOR}") +else(BOOST_VERSION_SUBMINOR GREATER 0) + set(BOOST_HEADER_DIR + "include/boost-${BOOST_VERSION_MAJOR}_${BOOST_VERSION_MINOR}") +endif(BOOST_VERSION_SUBMINOR GREATER 0) +install(DIRECTORY boost + DESTINATION ${BOOST_HEADER_DIR} + PATTERN "CVS" EXCLUDE + PATTERN ".svn" EXCLUDE) +# +# TDS 20080526: Getting a segfault here even with the ifs. At r45780, with these lines +# uncommented: +# 1. cmake the workspace +# 2. run ccmake and turn OFF BUILD_MULTI_THREADED and BUILD_SHARED +# 3. 'c' to configure +# 4. 'g' to generate.... segfault. +# 5. run rebuild_cache at the command line: no segfault this time. +# +# With these lines commented out, step 4 above does not segfault. +# +#if (NOT TEST_INSTALLED_TREE) + # If I don't have if around this, I get a seg fault +# install(EXPORT boost-targets DESTINATION "lib/Boost${BOOST_VERSION}") +#endif (NOT TEST_INSTALLED_TREE) +########################################################################## + +########################################################################## +# Binary packages # +########################################################################## +set(CPACK_PACKAGE_NAME "Boost") +set(CPACK_PACKAGE_VENDOR "Boost.org") +set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Boost ${BOOST_VERSION}") + +if (EXISTS "${Boost_SOURCE_DIR}/README.txt") + message(STATUS "Using generic cpack package description file.") + set(CPACK_PACKAGE_DESCRIPTION_FILE "${Boost_SOURCE_DIR}/README.txt") + set(CPACK_RESOURCE_FILE_README "${Boost_SOURCE_DIR}/README.txt") +endif () + +set(CPACK_RESOURCE_FILE_LICENSE "${Boost_SOURCE_DIR}/LICENSE_1_0.txt") +if (EXISTS "${Boost_SOURCE_DIR}/Welcome.txt") + message(STATUS "Using generic cpack welcome file.") + set(CPACK_RESOURCE_FILE_WELCOME "${Boost_SOURCE_DIR}/Welcome.txt") +endif() + +set(CPACK_PACKAGE_VERSION "${BOOST_VERSION}") +set(CPACK_PACKAGE_VERSION_MAJOR "${BOOST_VERSION_MAJOR}") +set(CPACK_PACKAGE_VERSION_MINOR "${BOOST_VERSION_MINOR}") +set(CPACK_PACKAGE_VERSION_PATCH "${BOOST_VERSION_SUBMINOR}") +set(CPACK_PACKAGE_INSTALL_DIRECTORY "Boost") + +if(WIN32 AND NOT UNIX) + # There is a bug in NSI that does not handle full unix paths properly. Make + # sure there is at least one set of four (4) backlasshes. + # NOTE: No Boost icon yet +# set(CPACK_PACKAGE_ICON "${Boost_SOURCE_DIR}/tools/build/CMake\\\\InstallIcon.bmp") +# set(CPACK_NSIS_INSTALLED_ICON_NAME "bin\\\\MyExecutable.exe") + set(CPACK_NSIS_DISPLAY_NAME "Boost ${BOOST_VERSION_MAJOR}.${BOOST_VERSION_MINOR}.${BOOST_VERSION_SUBMINOR}") + set(CPACK_NSIS_HELP_LINK "http:\\\\\\\\www.boost.org") + set(CPACK_NSIS_URL_INFO_ABOUT "http:\\\\\\\\www.boost.org") + set(CPACK_NSIS_CONTACT "boost-users@lists.boost.org") + set(CPACK_NSIS_MODIFY_PATH ON) + + # Encode the compiler name in the package + if (MSVC60) + set(CPACK_PACKAGE_FILE_NAME "Boost-${BOOST_VERSION}-vc6") + set(CPACK_NSIS_DISPLAY_NAME "${CPACK_NSIS_DISPLAY_NAME} for Microsoft Visual C++ 6") + elseif (MSVC70) + set(CPACK_PACKAGE_FILE_NAME "Boost-${BOOST_VERSION}-vc7") + set(CPACK_NSIS_DISPLAY_NAME "${CPACK_NSIS_DISPLAY_NAME} for Microsoft Visual Studio 2002") + elseif (MSVC71) + set(CPACK_PACKAGE_FILE_NAME "Boost-${BOOST_VERSION}-vc71") + set(CPACK_NSIS_DISPLAY_NAME "${CPACK_NSIS_DISPLAY_NAME} for Microsoft Visual Studio 2003") + elseif (MSVC80) + set(CPACK_PACKAGE_FILE_NAME "Boost-${BOOST_VERSION}-vc8") + set(CPACK_NSIS_DISPLAY_NAME "${CPACK_NSIS_DISPLAY_NAME} for Microsoft Visual Studio 2005") + elseif (MSVC90) + set(CPACK_PACKAGE_FILE_NAME "Boost-${BOOST_VERSION}-vc9") + set(CPACK_NSIS_DISPLAY_NAME "${CPACK_NSIS_DISPLAY_NAME} for Microsoft Visual Studio 2008") + elseif (BORLAND) + set(CPACK_PACKAGE_FILE_NAME "Boost-${BOOST_VERSION}-borland") + set(CPACK_NSIS_DISPLAY_NAME "${CPACK_NSIS_DISPLAY_NAME} for Borland C++ Builder") + endif (MSVC60) + set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "${CPACK_NSIS_DISPLAY_NAME}") +endif(WIN32 AND NOT UNIX) +include(CPack) + +if(COMMAND cpack_configure_downloads) + cpack_configure_downloads( + "http://www.osl.iu.edu/~dgregor/Boost-CMake/${BOOST_VERSION}/" + ALL ADD_REMOVE) +endif() +########################################################################## + +########################################################################## +# Building Boost libraries # +########################################################################## +# Always include the directory where Boost's include files will be. +if (TEST_INSTALLED_TREE) + # Use the headers from the installation directory + include_directories("${CMAKE_INSTALL_PREFIX}/${BOOST_HEADER_DIR}") +else (TEST_INSTALLED_TREE) + # Use the headers directly from the Boost source tree (in boost/) + include_directories(${Boost_SOURCE_DIR}) +endif (TEST_INSTALLED_TREE) + +# Boost.Build version 2 does this due to trouble with autolinking +# during building and testing. +# TODO: See if we can actually use auto-linking in our regression tests. +add_definitions(-DBOOST_ALL_NO_LIB=1) + +# Add build rules for documentation +add_subdirectory(doc) + +# Add build rules for all of the Boost libraries +add_subdirectory(${BOOST_LIBS_DIR}) + +# Add build rules for all of the Boost tools +# TODO: On hold while I work on the modularity code +add_subdirectory(tools) +########################################################################## + |