2
0
mirror of https://github.com/boostorg/build.git synced 2026-02-17 13:42:14 +00:00

Merge of cmakefiles *from* (that's right, *FROM* :/ ) release branch.

[SVN r53150]
This commit is contained in:
Troy D. Straszheim
2009-05-21 14:05:15 +00:00
parent 52d4bf2c87
commit b545b0257e
6 changed files with 238 additions and 127 deletions

View File

@@ -31,29 +31,42 @@ include(CheckCXXSourceCompiles)
# Python interpreter
#
include(FindPythonInterp)
message(STATUS "found python executable ${PYTHON_EXECUTABLE}")
include(FindPythonLibs)
message(STATUS "found python includes ${PYTHON_INCLUDE_PATH}")
message(STATUS "found python libs ${PYTHON_LIBRARIES}")
# Toolset detection.
if (NOT BOOST_TOOLSET)
set(BOOST_TOOLSET "unknown")
if (MSVC60)
set(BOOST_TOOLSET "vc6")
set(BOOST_COMPILER "msvc")
set(BOOST_COMPILER_VERSION "6.0")
elseif(MSVC70)
set(BOOST_TOOLSET "vc7")
set(BOOST_COMPILER "msvc")
set(BOOST_COMPILER_VERSION "7.0")
elseif(MSVC71)
set(BOOST_TOOLSET "vc71")
set(BOOST_COMPILER "msvc")
set(BOOST_COMPILER_VERSION "7.1")
elseif(MSVC80)
set(BOOST_TOOLSET "vc80")
set(BOOST_COMPILER "msvc")
set(BOOST_COMPILER_VERSION "8.0")
elseif(MSVC90)
set(BOOST_TOOLSET "vc90")
set(BOOST_COMPILER "msvc")
set(BOOST_COMPILER_VERSION "9.0")
elseif(MSVC)
set(BOOST_TOOLSET "vc")
set(BOOST_COMPILER "msvc")
set(BOOST_COMPILER_VERSION "unknown")
elseif(BORLAND)
set(BOOST_TOOLSET "bcb")
set(BOOST_COMPILER "msvc")
set(BOOST_COMPILER_VERSION "unknown")
elseif(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
set(BOOST_COMPILER "gcc")
# Execute GCC with the -dumpversion option, to give us a version string
execute_process(
COMMAND ${CMAKE_CXX_COMPILER} "-dumpversion"
@@ -62,6 +75,10 @@ if (NOT BOOST_TOOLSET)
# Match only the major and minor versions of the version string
string(REGEX MATCH "[0-9]+.[0-9]+" GCC_MAJOR_MINOR_VERSION_STRING
"${GCC_VERSION_STRING}")
# Match the full compiler version for the build name
string(REGEX MATCH "[0-9]+.[0-9]+.[0-9]+" BOOST_COMPILER_VERSION
"${GCC_VERSION_STRING}")
# Strip out the period between the major and minor versions
string(REGEX REPLACE "\\." "" BOOST_VERSIONING_GCC_VERSION
@@ -69,33 +86,71 @@ if (NOT BOOST_TOOLSET)
# Set the GCC versioning toolset
set(BOOST_TOOLSET "gcc${BOOST_VERSIONING_GCC_VERSION}")
elseif(CMAKE_CXX_COMPILER MATCHES "/icpc$" OR CMAKE_CXX_COMPILER MATCHES "/icpc.exe$")
set(BOOST_TOOLSET "intel")
set(BOOST_COMPILER "intel")
set(CMAKE_COMPILER_IS_INTEL ON)
execute_process(
COMMAND ${CMAKE_CXX_COMPILER} "-dumpversion"
OUTPUT_VARIABLE INTEL_VERSION_STRING
OUTPUT_STRIP_TRAILING_WHITESPACE)
set(BOOST_COMPILER_VERSION ${INTEL_VERSION_STRING})
endif(MSVC60)
endif (NOT BOOST_TOOLSET)
message(STATUS "Boost compiler: ${BOOST_COMPILER}")
message(STATUS "Boost toolset: ${BOOST_TOOLSET}")
# create cache entry
set(BOOST_PLATFORM "unknown" CACHE STRING "Boost platform name")
# Multi-threading support
if(CMAKE_SYSTEM_NAME STREQUAL "SunOS")
set(MULTI_THREADED_COMPILE_FLAGS "-pthreads")
set(MULTI_THREADED_LINK_LIBS rt)
set(BOOST_PLATFORM "sunos")
elseif(CMAKE_SYSTEM_NAME STREQUAL "BeOS")
# No threading options necessary for BeOS
set(BOOST_PLATFORM "beos")
elseif(CMAKE_SYSTEM_NAME MATCHES ".*BSD")
set(MULTI_THREADED_COMPILE_FLAGS "-pthread")
set(MULTI_THREADED_LINK_LIBS pthread)
set(BOOST_PLATFORM "bsd")
elseif(CMAKE_SYSTEM_NAME STREQUAL "DragonFly")
# DragonFly is FreeBSD bariant
# DragonFly is a FreeBSD bariant
set(MULTI_THREADED_COMPILE_FLAGS "-pthread")
set(BOOST_PLATFORM "dragonfly")
elseif(CMAKE_SYSTEM_NAME STREQUAL "IRIX")
# TODO: GCC on Irix doesn't support multi-threading?
set(BOOST_PLATFORM "irix")
elseif(CMAKE_SYSTEM_NAME STREQUAL "HP-UX")
# TODO: gcc on HP-UX does not support multi-threading?
set(BOOST_PLATFORM "hpux")
elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
# No threading options necessary for Mac OS X
set(BOOST_PLATFORM "macos")
elseif(UNIX)
# Assume -pthread and -lrt on all other variants
set(MULTI_THREADED_COMPILE_FLAGS "-pthread -D_REENTRANT")
set(MULTI_THREADED_LINK_FLAGS "")
set(MULTI_THREADED_LINK_LIBS pthread rt)
endif(CMAKE_SYSTEM_NAME STREQUAL "SunOS")
if (MINGW)
set(BOOST_PLATFORM "mingw")
elseif(CYGWIN)
set(BOOST_PLATFORM "cygwin")
elseif (CMAKE_SYSTEM_NAME STREQUAL "Linux")
set(BOOST_PLATFORM "linux")
else()
set(BOOST_PLATFORM "unix")
endif()
elseif(WIN32)
set(BOOST_PLATFORM "windows")
else()
set(BOOST_PLATFORM "unknown")
endif()
message(STATUS "Boost platform: ${BOOST_PLATFORM}")
# Setup DEBUG_COMPILE_FLAGS, RELEASE_COMPILE_FLAGS, DEBUG_LINK_FLAGS and
# and RELEASE_LINK_FLAGS based on the CMake equivalents
@@ -159,3 +214,6 @@ set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "" CACHE INTERNAL "Unused by Boost")
set(CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO "" CACHE INTERNAL "Unused by Boost")
set(CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO "" CACHE INTERNAL "Unused by Boost")
set(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "" CACHE INTERNAL "Unused by Boost")
# Set the build name
set(BUILDNAME "${BOOST_COMPILER}-${BOOST_COMPILER_VERSION}-${BOOST_PLATFORM}")

View File

@@ -1,8 +1,8 @@
##########################################################################
# Core Functionality for Boost #
##########################################################################
# Copyright (C) 2007-2008 Douglas Gregor <doug.gregor@gmail.com> #
# Copyright (C) 2007 Troy Straszheim #
# Copyright (C) 2007-2009 Douglas Gregor <doug.gregor@gmail.com> #
# Copyright (C) 2007-2009 Troy Straszheim <troy@resophonic.com> #
# #
# Distributed under the Boost Software License, Version 1.0. #
# See accompanying file LICENSE_1_0.txt or copy at #
@@ -56,7 +56,7 @@ add_custom_target(modularize)
# therefore, will build and install the library binary.
#
# For libraries that have regression tests, and when testing is
# enabled globally by the BUILD_TESTING option, this macro also
# enabled globally by the BUILD_REGRESSION_TESTS option, this macro also
# defines the TEST_BOOST_LIBNAME option (defaults to ON). When ON, the
# generated makefiles/project files will contain regression tests for
# this library.
@@ -181,7 +181,8 @@ macro(boost_library_project LIBNAME)
endif (THIS_PROJECT_DESCRIPTION)
# Create a component group for this library
cpack_add_component_group(${libname}
fix_cpack_component_name(CPACK_COMPONENT_GROUP_NAME ${libname})
cpack_add_component_group(${CPACK_COMPONENT_GROUP_NAME}
DISPLAY_NAME "${LIBNAME}"
DESCRIPTION ${THIS_PROJECT_DESCRIPTION})
endif ()
@@ -191,9 +192,18 @@ macro(boost_library_project LIBNAME)
# Add this module's include directory
include_directories("${Boost_SOURCE_DIR}/libs/${libname}/include")
#
# Horrible hackery. Make install of headers from modularized directories
# OPTIONAL, which only works on cmake >= 2.7
#
if (${CMAKE_MAJOR_VERSION} GREATER 1 AND ${CMAKE_MINOR_VERSION} GREATER 6)
set(_INSTALL_OPTIONAL "OPTIONAL")
endif()
# Install this module's headers
install(DIRECTORY include/boost
DESTINATION ${BOOST_HEADER_DIR}
${_INSTALL_OPTIONAL}
COMPONENT ${libname}_headers
PATTERN "CVS" EXCLUDE
PATTERN ".svn" EXCLUDE)
@@ -212,9 +222,10 @@ macro(boost_library_project LIBNAME)
endforeach(DEP)
# Tell CPack about the headers component
fix_cpack_component_name(CPACK_COMPONENT_GROUP_NAME ${libname})
cpack_add_component(${libname}_headers
DISPLAY_NAME "Header files"
GROUP ${libname}
GROUP ${CPACK_COMPONENT_GROUP_NAME}
DEPENDS ${THIS_PROJECT_HEADER_DEPENDS})
endif ()
endif ()
@@ -311,7 +322,7 @@ macro(boost_library_project LIBNAME)
endforeach(SUBDIR ${THIS_PROJECT_SRCDIRS})
endif()
if(BUILD_TESTING AND THIS_PROJECT_TESTDIRS)
if(BUILD_REGRESSION_TESTS AND THIS_PROJECT_TESTDIRS)
# Testing is enabled globally and this project has some
# tests. Check whether we should include these tests.
if (BOOST_TEST_LIBRARIES)
@@ -326,6 +337,14 @@ macro(boost_library_project LIBNAME)
endforeach ()
endif()
# Create a target <library name>-test, which will run all of
# this library's tests.
if (THIS_PROJECT_TESTDIRS)
add_custom_target(${PROJECT_NAME}-test
COMMAND ${CMAKE_CTEST_COMMAND} -R "^${PROJECT_NAME}-*"
MESSAGE "Running tests for Boost.${PROJECT_NAME}...")
endif ()
# Include the test directories.
foreach(SUBDIR ${THIS_PROJECT_TESTDIRS})
add_subdirectory(${SUBDIR})
@@ -613,7 +632,7 @@ endmacro(boost_feature_interactions)
#
# If any of the features listed conflict with this library, no new
# targets will be built. For example, if the library provides the
# option NOT_MULTI_THREADED, and one of the features provided is
# option NO_MULTI_THREADED, and one of the features provided is
# MULTI_THREADED, this macro will essentially be a no-op.
macro(boost_library_variant LIBNAME)
set(THIS_VARIANT_COMPILE_FLAGS "${THIS_LIB_COMPILE_FLAGS}")
@@ -655,15 +674,6 @@ macro(boost_library_variant LIBNAME)
# We handle static vs. dynamic libraries differently
list_contains(THIS_LIB_IS_STATIC "STATIC" ${ARGN})
if (THIS_LIB_IS_STATIC)
# If the STATIC_TAG flag was set, we append "-s" to the name of
# the library. This is an unfortunate hack, needed only for the
# test library.
if (THIS_LIB_STATIC_TAG)
set(THIS_LIB_STATIC_TAG "-s")
else(THIS_LIB_STATIC_TAG)
set(THIS_LIB_STATIC_TAG "")
endif(THIS_LIB_STATIC_TAG)
# On Windows, we need static and shared libraries to have
# different names, so we follow the Boost.Build version 2 style
# and prepend "lib" to the name.
@@ -679,7 +689,7 @@ macro(boost_library_variant LIBNAME)
# Set properties on this library
set_target_properties(${VARIANT_LIBNAME}
PROPERTIES
OUTPUT_NAME "${LIBPREFIX}${LIBNAME}${VARIANT_VERSIONED_NAME}${THIS_LIB_STATIC_TAG}"
OUTPUT_NAME "${LIBPREFIX}${LIBNAME}${VARIANT_VERSIONED_NAME}"
CLEAN_DIRECT_OUTPUT 1
COMPILE_FLAGS "${THIS_VARIANT_COMPILE_FLAGS}"
LINK_FLAGS "${THIS_VARIANT_LINK_FLAGS}"
@@ -718,7 +728,9 @@ macro(boost_library_variant LIBNAME)
# The basic LIBNAME target depends on each of the variants
add_dependencies(${LIBNAME} ${VARIANT_LIBNAME})
export(TARGETS ${VARIANT_LIBNAME} FILE ${CMAKE_BINARY_DIR}/exports/${VARIANT_LIBNAME}.cmake)
# Link against whatever libraries this library depends on
target_link_libraries(${VARIANT_LIBNAME} ${THIS_VARIANT_LINK_LIBS})
foreach(dependency ${THIS_LIB_DEPENDS})
@@ -760,9 +772,10 @@ macro(boost_library_variant LIBNAME)
endforeach(DEP)
if (COMMAND cpack_add_component)
fix_cpack_component_name(CPACK_COMPONENT_GROUP_NAME ${libname})
cpack_add_component(${LIB_COMPONENT}
DISPLAY_NAME "${VARIANT_DISPLAY_NAME}"
GROUP ${libname}
GROUP ${CPACK_COMPONENT_GROUP_NAME}
DEPENDS ${THIS_LIB_COMPONENT_DEPENDS})
endif ()
endif(NOT THIS_LIB_NO_INSTALL)
@@ -1038,9 +1051,8 @@ endmacro(boost_select_variant)
# [LINK_LIBS linklibs]
# [feature_LINK_LIBS linklibs]
# [DEPENDS libdepend1 libdepend2 ...]
# [STATIC_TAG]
# [MODULE]
# [NOT_feature]
# [NO_feature]
# [EXTRA_VARIANTS variant1 variant2 ...]
# [FORCE_VARIANTS variant1])
#
@@ -1107,16 +1119,6 @@ endmacro(boost_select_variant)
# boost_python, multi-threaded variants of boost_mpi_python will
# link against multi-threaded variants of boost_python.
#
# STATIC_TAG: States that the name of static library variants on
# Unix need to be named differently from shared library
# variants. This particular option should only be used in rare cases
# where the static and shared library variants are incompatible,
# such that linking against the shared library rather than the
# static library will cause features. When this option is provided,
# static libraries on Unix variants will have "-s" appended to their
# names. Note: we hope that this is a temporary solution. At
# present, it is only used by the Test library.
#
# MODULE: This option states that, when building a shared library,
# the shared library should be built as a module rather than a
# normal shared library. Modules have special meaning an behavior on
@@ -1151,14 +1153,11 @@ endmacro(boost_select_variant)
macro(boost_add_library LIBNAME)
parse_arguments(THIS_LIB
"DEPENDS;COMPILE_FLAGS;LINK_FLAGS;LINK_LIBS;EXTRA_VARIANTS;FORCE_VARIANTS;${BOOST_ADD_ARG_NAMES}"
"STATIC_TAG;MODULE;NO_INSTALL;${BOOST_ADDLIB_OPTION_NAMES}"
"MODULE;NO_INSTALL;${BOOST_ADDLIB_OPTION_NAMES}"
${ARGN}
)
set(THIS_LIB_SOURCES ${THIS_LIB_DEFAULT_ARGS})
string(TOUPPER "${LIBNAME}_COMPILED_LIB" compiled_lib)
set (${compiled_lib} TRUE CACHE INTERNAL "")
if (NOT TEST_INSTALLED_TREE)
# A top-level target that refers to all of the variants of the
# library, collectively.
@@ -1212,9 +1211,6 @@ macro(boost_add_single_library LIBNAME)
)
set(THIS_LIB_SOURCES ${THIS_LIB_DEFAULT_ARGS})
string(TOUPPER "${LIBNAME}_COMPILED_LIB" compiled_lib)
set (${compiled_lib} TRUE CACHE INTERNAL "")
if (NOT TEST_INSTALLED_TREE)
boost_select_variant(${LIBNAME} THIS_LIB)
if (THIS_LIB_VARIANT)
@@ -1382,11 +1378,6 @@ macro(boost_add_executable EXENAME)
endforeach(LIB ${THIS_EXE_DEPENDS})
# Build the executable
# TODO: the use of ${PROJECT_NAME}/${EXENAME} is a bit strange.
# It's designed to keep the names of regression tests from one library
# separate from the regression tests of another library, but this can
# be handled better with OUTPUT_NAME. This would also allow us to eliminate
# the directory-creation logic in boost_library_project.
if (THIS_PROJECT_IS_TOOL)
set(THIS_EXE_NAME ${EXENAME})
else()

View File

@@ -118,6 +118,9 @@ macro(xsl_transform OUTPUT INPUT)
elseif(THIS_XSL_MAKE_TARGET)
add_custom_target(${THIS_XSL_MAKE_TARGET}
DEPENDS ${THIS_XSL_OUTPUT_FILE})
set_target_properties(${THIS_XSL_MAKE_TARGET}
PROPERTIES
EXCLUDE_FROM_ALL ON)
endif()
endif()
endmacro(xsl_transform)
@@ -166,20 +169,12 @@ macro(doxygen_to_boostbook OUTPUT)
file(APPEND ${DOXYFILE} "${PARAM}\n")
endforeach(PARAM)
set(THIS_DOXY_MODULAR_HEADER_PATH ${CMAKE_SOURCE_DIR}/libs/${libname}/include)
set(THIS_DOXY_HEADER_PATH ${CMAKE_SOURCE_DIR}/libs/${libname}/include)
set(THIS_DOXY_HEADER_LIST "")
set(THIS_DOXY_HEADERS)
foreach(HDR ${THIS_DOXY_DEFAULT_ARGS})
if(EXISTS ${CMAKE_SOURCE_DIR}/${HDR})
list(APPEND THIS_DOXY_HEADERS ${CMAKE_SOURCE_DIR}/${HDR})
elseif(EXISTS ${THIS_DOXY_MODULAR_HEADER_PATH}/${HDR})
list(APPEND THIS_DOXY_HEADERS ${THIS_DOXY_MODULAR_HEADER_PATH}/${HDR})
else(EXISTS ${CMAKE_SOURCE_DIR}/${HDR})
message("Warning: Attempting to generate doxygen to boostbook target for header ${HDR},")
message(" which was not found in the main source directory or in a modularized location")
endif(EXISTS ${CMAKE_SOURCE_DIR}/${HDR})
list(APPEND THIS_DOXY_HEADERS ${THIS_DOXY_HEADER_PATH}/${HDR})
set(THIS_DOXY_HEADER_LIST
"${THIS_DOXY_HEADER_LIST} ${THIS_DOXY_HEADER_PATH}/${HDR}")
endforeach(HDR)
@@ -286,17 +281,22 @@ macro(boost_add_documentation SOURCE)
get_filename_component(THIS_DOC_EXT ${SOURCE} EXT)
string(TOUPPER ${THIS_DOC_EXT} THIS_DOC_EXT)
if (THIS_DOC_EXT STREQUAL ".QBK")
# Transform Quickbook into BoostBook XML
get_filename_component(SOURCE_FILENAME ${SOURCE} NAME_WE)
set(BOOSTBOOK_FILE ${SOURCE_FILENAME}.xml)
add_custom_command(OUTPUT ${BOOSTBOOK_FILE}
COMMAND quickbook "--output-file=${BOOSTBOOK_FILE}"
${THIS_DOC_SOURCE_PATH}
DEPENDS ${THIS_DOC_SOURCE_PATH} ${THIS_DOC_DEFAULT_ARGS}
COMMENT "Generating BoostBook documentation for Boost.${PROJECT_NAME}...")
if (BUILD_QUICKBOOK)
# Transform Quickbook into BoostBook XML
get_filename_component(SOURCE_FILENAME ${SOURCE} NAME_WE)
set(BOOSTBOOK_FILE ${SOURCE_FILENAME}.xml)
add_custom_command(OUTPUT ${BOOSTBOOK_FILE}
COMMAND quickbook "--output-file=${BOOSTBOOK_FILE}"
${THIS_DOC_SOURCE_PATH}
DEPENDS ${THIS_DOC_SOURCE_PATH} ${THIS_DOC_DEFAULT_ARGS}
COMMENT "Generating BoostBook documentation for Boost.${PROJECT_NAME}...")
# Transform BoostBook into other formats
boost_add_documentation(${CMAKE_CURRENT_BINARY_DIR}/${BOOSTBOOK_FILE})
# Transform BoostBook into other formats
boost_add_documentation(${CMAKE_CURRENT_BINARY_DIR}/${BOOSTBOOK_FILE})
else()
message(SEND_ERROR
"Quickbook is required to build Boost documentation.\nQuickbook can be built by enabling the BUILD_QUICKBOOK.")
endif()
elseif (THIS_DOC_EXT STREQUAL ".XML")
# Transform BoostBook XML into DocBook XML
get_filename_component(SOURCE_FILENAME ${SOURCE} NAME_WE)
@@ -319,25 +319,17 @@ macro(boost_add_documentation SOURCE)
STYLESHEET ${BOOSTBOOK_XSL_DIR}/html.xsl
CATALOG ${CMAKE_BINARY_DIR}/catalog.xml
DIRECTORY HTML.manifest
PARAMETERS admon.graphics.path=images/
navig.graphics.path=images/
PARAMETERS admon.graphics.path=images
navig.graphics.path=images
boost.image.src=boost.png
COMMENT "Generating HTML documentation for Boost.${PROJECT_NAME}..."
COMMENT "Generating HTML documentaiton for Boost.${PROJECT_NAME}..."
MAKE_TARGET ${PROJECT_NAME}-html)
add_dependencies(html ${PROJECT_NAME}-html)
#
# Install associated stuff
#
add_custom_command(TARGET ${PROJECT_NAME}-html
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/doc/src/boostbook.css ${CMAKE_CURRENT_BINARY_DIR}/html/boostbook.css
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/doc/src/docutils.css ${CMAKE_CURRENT_BINARY_DIR}/html/docutils.css
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/doc/src/reference.css ${CMAKE_CURRENT_BINARY_DIR}/html/reference.css
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/boost.png ${CMAKE_CURRENT_BINARY_DIR}/html/boost.png
COMMENT "Copying in associated stuff, boostbook.css and boost.png"
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/doc/src/boostbook.css ${CMAKE_CURRENT_BINARY_DIR}/html
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/boost.png ${CMAKE_CURRENT_BINARY_DIR}/html
)
# Install generated documentation
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html
DESTINATION share/boost-${BOOST_VERSION}
@@ -354,8 +346,7 @@ macro(boost_add_documentation SOURCE)
CATALOG ${CMAKE_BINARY_DIR}/catalog.xml
DIRECTORY man.manifest
COMMENT "Generating man pages for Boost.${PROJECT_NAME}..."
MAKE_ALL_TARGET ${PROJECT_NAME}-manpages)
add_dependencies(manpages ${PROJECT_NAME}-manpages)
MAKE_TARGET ${PROJECT_NAME}-man)
# Install man pages
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/man
@@ -456,9 +447,6 @@ set(WANT_DOCBOOK_XSL_VERSION 1.73.2)
find_program(XSLTPROC xsltproc DOC "xsltproc transforms XML via XSLT")
set(XSLTPROC_FLAGS "--xinclude" CACHE STRING
"Flags to pass to xsltproc to transform XML documents")
if(NOT XSLTPROC)
message(STATUS "xsltproc not found... this will disable build of documentation.")
endif()
# Find the DocBook DTD (version 4.2)
find_path(DOCBOOK_DTD_DIR docbookx.dtd
@@ -489,12 +477,8 @@ if (XSLTPROC AND DOXYGEN)
if (DOCBOOK_DTD_DIR AND DOCBOOK_XSL_DIR)
# Documentation build options
option(BUILD_DOCUMENTATION "Whether to build library documentation" ON)
option(BUILD_DOCUMENTATION_HTML "Whether to build HTML documentation" ON)
add_custom_target(html)
option(BUILD_DOCUMENTATION_MAN_PAGES "Whether to build Unix man pages" ON)
add_custom_target(manpages)
# Generate an XML catalog file.
configure_file(${CMAKE_SOURCE_DIR}/tools/build/CMake/catalog.xml.in
@@ -520,30 +504,31 @@ if (XSLTPROC AND DOXYGEN)
endif()
endif()
set(BUILD_OCUMENTATION_OKAY TRUE)
if (NOT XSLTPROC)
message(STATUS "XSLTPROC not found, disabling build of documentation")
set(BUILD_DOCUMENTATION_OKAY FALSE)
elseif (NOT DOXYGEN)
message(STATUS "DOXYGEN not found, disabling build of documentation")
set(BUILD_DOCUMENTATION_OKAY FALSE)
elseif (NOT DOCBOOK_DTD_DIR)
message(STATUS "DOCBOOK_DTD_DIR not found, disabling build of documentation")
message(STATUS "Set DOCBOOK_AUTOCONFIG to ON to get it automatically")
set(BUILD_DOCUMENTATION_OKAY FALSE)
elseif (NOT DOCBOOK_XSL_DIR)
message(STATUS "DOCBOOK_XSL_DIR not found, disabling build of documentation")
message(STATUS "Set DOCBOOK_AUTOCONFIG to ON to get it automatically")
set(BUILD_DOCUMENTATION_OKAY FALSE)
else()
message(STATUS "Documentation prerequisites found, enabling docs build.")
# Turn off BUILD_DOCUMENTATION if it isn't going to succeed.
if (BUILD_DOCUMENTATION)
set(BUILD_DOCUMENTATION_OKAY TRUE)
endif()
if (NOT BUILD_DOCUMENTATION_OKAY)
if (BUILD_DOCUMENTATION)
set(BUILD_DOCUMENTATION OFF CACHE BOOL
"Whether to build library documentation" FORCE)
if (NOT XSLTPROC)
set(BUILD_DOCUMENTATION_OKAY FALSE)
message(STATUS "Docs build disabled due to missing xsltproc")
elseif (NOT DOXYGEN)
set(BUILD_DOCUMENTATION_OKAY FALSE)
message(STATUS "Docs build disabled due to missing doxygen")
elseif (NOT DOCBOOK_DTD_DIR)
set(BUILD_DOCUMENTATION_OKAY FALSE)
message(STATUS "Docs build disabled due to missing docbook dtd dir")
message(STATUS "You can set DOCBOOK_AUTOCONFIG to attempt this automatically.")
elseif (NOT DOCBOOK_XSL_DIR)
set(BUILD_DOCUMENTATION_OKAY FALSE)
message(STATUS "Docs build disabled due to missing docbook xsl dir")
message(STATUS "You can set DOCBOOK_AUTOCONFIG to attempt this automatically.")
else()
set(BUILD_DOCUMENTATION_OKAY TRUE)
endif()
endif()
if (NOT BUILD_DOCUMENTATION_OKAY)
if (BUILD_DOCUMENTATION)
set(BUILD_DOCUMENTATION OFF CACHE BOOL
"Whether to build library documentation" FORCE)
endif()
endif()
endif()

View File

@@ -37,10 +37,11 @@
# want or need to perform regression testing on Boost. The Boost build
# is significantly faster when we aren't also building regression
# tests.
option(BUILD_TESTING "Enable testing" OFF)
option(BUILD_REGRESSION_TESTS "Enable regression testing" OFF)
if (BUILD_TESTING)
if (BUILD_REGRESSION_TESTS)
enable_testing()
mark_as_advanced(BUILD_TESTING)
option(TEST_INSTALLED_TREE "Enable testing of an already-installed tree" OFF)
@@ -50,7 +51,10 @@ if (BUILD_TESTING)
if (TEST_INSTALLED_TREE)
include("${CMAKE_INSTALL_PREFIX}/lib/Boost${BOOST_VERSION}/boost-targets.cmake")
endif (TEST_INSTALLED_TREE)
endif (BUILD_TESTING)
set(DART_TESTING_TIMEOUT=15 CACHE INTEGER "Timeout after this much madness")
endif (BUILD_REGRESSION_TESTS)
#-------------------------------------------------------------------------------
# This macro adds additional include directories based on the dependencies of
@@ -121,9 +125,9 @@ macro(boost_additional_test_dependencies libname)
endwhile()
endforeach()
foreach (include ${THIS_TEST_DEPENDS_ALL})
include_directories("${Boost_SOURCE_DIR}/libs/${include}/include")
endforeach (include ${includes})
foreach (include ${THIS_TEST_DEPENDS_ALL})
include_directories("${Boost_SOURCE_DIR}/libs/${include}/include")
endforeach (include ${includes})
endmacro(boost_additional_test_dependencies libname)
#-------------------------------------------------------------------------------
@@ -140,6 +144,7 @@ endmacro(boost_additional_test_dependencies libname)
# [LINK_FLAGS linkflags]
# [LINK_LIBS linklibs]
# [DEPENDS libdepend1 libdepend2 ...]
# [KNOWN_FAILURES string1 string2 ...]
# [COMPILE] [RUN] [FAIL])
#
# testname is the name of the test. The remaining arguments passed to
@@ -169,7 +174,7 @@ macro(boost_test_parse_args testname)
set(BOOST_TEST_OKAY TRUE)
set(BOOST_TEST_COMPILE_FLAGS "")
parse_arguments(BOOST_TEST
"BOOST_LIB;LINK_LIBS;LINK_FLAGS;DEPENDS;COMPILE_FLAGS;ARGS;EXTRA_OPTIONS"
"BOOST_LIB;LINK_LIBS;LINK_FLAGS;DEPENDS;COMPILE_FLAGS;ARGS;EXTRA_OPTIONS;KNOWN_FAILURES"
"COMPILE;RUN;LINK;FAIL;RELEASE;DEBUG"
${ARGN}
)
@@ -203,12 +208,24 @@ macro(boost_test_parse_args testname)
set(BOOST_TEST_TESTNAME "${PROJECT_NAME}-${testname}")
#message("testname: ${BOOST_TEST_TESTNAME}")
# If testing is turned off, this test is not okay
if (NOT BUILD_TESTING)
if (NOT BUILD_REGRESSION_TESTS)
set(BOOST_TEST_OKAY FALSE)
endif(NOT BUILD_TESTING)
endif(NOT BUILD_REGRESSION_TESTS)
endmacro(boost_test_parse_args)
# This macro attaches a the "known-failure" label to the given test
# target if the build name matches any of the declared, known
# failures.
macro(boost_test_known_failures TEST)
foreach(PATTERN ${ARGN})
if (${BUILDNAME} MATCHES ${PATTERN})
set_tests_properties("${PROJECT_NAME}-${TEST}"
PROPERTIES LABELS "${PROJECT_NAME};known-failure")
endif()
endforeach()
endmacro(boost_test_known_failures)
# This macro creates a Boost regression test that will be executed. If
# the test can be built, executed, and exits with a return code of
# zero, it will be considered to have passed.
@@ -281,6 +298,11 @@ macro(boost_test_run testname)
PROPERTIES
LABELS "${PROJECT_NAME}"
)
boost_test_known_failures(${testname} ${BOOST_TEST_KNOWN_FAILURES})
# Make sure that the -test target that corresponds to this
# library or tool depends on this test executable.
add_dependencies(${PROJECT_NAME}-test ${THIS_EXE_NAME})
if (BOOST_TEST_FAIL)
set_tests_properties(${BOOST_TEST_TESTNAME} PROPERTIES WILL_FAIL ON)
@@ -352,6 +374,8 @@ macro(boost_test_compile testname)
LABELS "${PROJECT_NAME}"
)
boost_test_known_failures(${testname} ${BOOST_TEST_KNOWN_FAILURES})
if (BOOST_TEST_FAIL)
set_tests_properties(${BOOST_TEST_TESTNAME} PROPERTIES WILL_FAIL ON)
endif ()
@@ -372,22 +396,46 @@ endmacro(boost_test_compile_fail)
#
# boost_test_link:
#
# Under construction.
#
# Each library "exports" itself to
# ${CMAKE_BINARY_DIR}/exports/<variantname>.cmake
#
# The list of 'depends' for these libraries has to match one of those
# files, this way the export mechanism works. The generated
# cmakelists will include() those exported .cmake files, for each
# DEPENDS.
#
#
macro(boost_test_link testname)
boost_test_parse_args(${testname} ${ARGN} LINK)
if(BOOST_TEST_OKAY)
# Determine the include directories to pass along to the underlying
# project.
# works but not great
get_directory_property(BOOST_TEST_INCLUDE_DIRS INCLUDE_DIRECTORIES)
set(BOOST_TEST_INCLUDES "")
foreach(DIR ${BOOST_TEST_INCLUDE_DIRS})
set(BOOST_TEST_INCLUDES "${BOOST_TEST_INCLUDES};${DIR}")
endforeach(DIR ${BOOST_TEST_INCLUDE_DIRS})
add_test(${BOOST_TEST_TESTNAME}
${CMAKE_CTEST_COMMAND}
-VV
--build-and-test
${Boost_SOURCE_DIR}/tools/build/CMake/LinkTest
${Boost_BINARY_DIR}/tools/build/CMake/LinkTest
--build-generator ${CMAKE_GENERATOR}
--build-makeprogram ${CMAKE_MAKE_PROGRAM}
--build-project LinkTest
--build-options
"-DCMAKE_CXX_COMPILER:FILEPATH=${CMAKE_CXX_COMPILER}"
"-DCMAKE_C_COMPILER:FILEPATH=${CMAKE_C_COMPILER}"
"-DBOOST_EXPORTS_DIR:FILEPATH=${CMAKE_BINARY_DIR}/exports"
"-DSOURCE:STRING=${CMAKE_CURRENT_SOURCE_DIR}/${BOOST_TEST_SOURCES}"
"-DINCLUDES:STRING=${BOOST_TEST_INCLUDES}"
"-DCOMPILE_FLAGS:STRING=${BOOST_TEST_COMPILE_FLAGS}"
"-DLINK_LIBS:STRING=${BOOST_TEST_LINK_LIBS}"
"-DDEPENDS:STRING=${BOOST_TEST_DEPENDS}"
)
set_tests_properties(${BOOST_TEST_TESTNAME}
@@ -395,6 +443,8 @@ macro(boost_test_link testname)
LABELS "${PROJECT_NAME}"
)
boost_test_known_failures(${testname} ${BOOST_TEST_KNOWN_FAILURES})
if (BOOST_TEST_FAIL)
set_tests_properties(${BOOST_TEST_TESTNAME} PROPERTIES WILL_FAIL ON)
endif ()

View File

@@ -211,3 +211,17 @@ function(topological_sort LIST PREFIX SUFFIX)
set(${LIST} ${${LIST}} PARENT_SCOPE)
endfunction(topological_sort)
# Small little hack that tweaks a component name (as used for CPack)
# to make sure to avoid certain names that cause problems. Sets the
# variable named varname to the "sanitized" name.
#
# FIXME: This is a complete hack. We probably need to fix the CPack
# generators (NSIS in particular) to get rid of the need for this.
macro(fix_cpack_component_name varname name)
if (${name} STREQUAL "foreach")
set(${varname} "boost_foreach")
else()
set(${varname} ${name})
endif()
endmacro()

View File

@@ -1,7 +1,20 @@
cmake_minimum_required(VERSION 2.6)
file(GLOB BOOST_EXPORTS "${BOOST_EXPORTS_DIR}/*.cmake")
foreach(import
${DEPENDS})
include(${BOOST_EXPORTS_DIR}/${import}.cmake)
endforeach()
project(LinkTest)
include_directories (${INCLUDES})
add_executable(link-test ${SOURCE} COMPILE_FLAGS "${COMPILE_FLAGS}")
add_executable(link-test ${SOURCE})
set_source_files_properties(${SOURCE}
PROPERTIES COMPILE_FLAGS "${COMPILE_FLAGS}")
PROPERTIES COMPILE_FLAGS "${COMPILE_FLAGS}")
message("DEPENDS=====${DEPENDS}")
target_link_libraries(link-test
${LINK_LIBS}
${DEPENDS})