mirror of
https://github.com/boostorg/build.git
synced 2026-02-16 01:12:13 +00:00
rm cmake from the release branch before it goes out broken. Policy dictates that you never commit to release, you commit to trunk and merge to release.
[SVN r56941]
This commit is contained in:
@@ -1,222 +0,0 @@
|
||||
##########################################################################
|
||||
# Boost Configuration Support #
|
||||
##########################################################################
|
||||
# Copyright (C) 2007 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 #
|
||||
##########################################################################
|
||||
# This module defines several variables that provide information about #
|
||||
# the target compiler and platform. #
|
||||
# #
|
||||
# Variables defined: #
|
||||
# #
|
||||
# BOOST_TOOLSET: #
|
||||
# The Boost toolset name, used by the library version mechanism to #
|
||||
# encode the compiler and version into the name of the #
|
||||
# library. This toolset name will correspond with Boost.Build #
|
||||
# version 2's toolset name, including version number. #
|
||||
# #
|
||||
# MULTI_THREADED_COMPILE_FLAGS: #
|
||||
# Compilation flags when building multi-threaded programs. #
|
||||
# #
|
||||
# MULTI_THREADED_LINK_FLAGS: #
|
||||
# Linker flags when building multi-threaded programs. #
|
||||
##########################################################################
|
||||
include(CheckCXXSourceCompiles)
|
||||
|
||||
#
|
||||
# Python interpreter
|
||||
#
|
||||
include(FindPythonInterp)
|
||||
include(FindPythonLibs)
|
||||
|
||||
# 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"
|
||||
OUTPUT_VARIABLE GCC_VERSION_STRING)
|
||||
|
||||
# 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
|
||||
"${GCC_MAJOR_MINOR_VERSION_STRING}")
|
||||
|
||||
# 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")
|
||||
|
||||
# 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 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)
|
||||
|
||||
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()
|
||||
|
||||
# create cache entry
|
||||
set(BOOST_PLATFORM ${BOOST_PLATFORM} CACHE STRING "Boost platform name")
|
||||
|
||||
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
|
||||
if(CMAKE_CXX_FLAGS_DEBUG)
|
||||
if(MSVC)
|
||||
# Eliminate the /MDd flag; we'll add it back when we need it
|
||||
string(REPLACE "/MDd" "" CMAKE_CXX_FLAGS_DEBUG
|
||||
"${CMAKE_CXX_FLAGS_DEBUG}")
|
||||
endif(MSVC)
|
||||
set(DEBUG_COMPILE_FLAGS "${CMAKE_CXX_FLAGS_DEBUG}" CACHE STRING "Compilation flags for debug libraries")
|
||||
endif(CMAKE_CXX_FLAGS_DEBUG)
|
||||
if(CMAKE_CXX_FLAGS_RELEASE)
|
||||
if(MSVC)
|
||||
# Eliminate the /MD flag; we'll add it back when we need it
|
||||
string(REPLACE "/MD" "" CMAKE_CXX_FLAGS_RELEASE
|
||||
"${CMAKE_CXX_FLAGS_RELEASE}")
|
||||
endif(MSVC)
|
||||
set(RELEASE_COMPILE_FLAGS "${CMAKE_CXX_FLAGS_RELEASE}" CACHE STRING "Compilation flags for release libraries")
|
||||
endif(CMAKE_CXX_FLAGS_RELEASE)
|
||||
if(CMAKE_SHARED_LINKER_FLAGS_DEBUG)
|
||||
set(DEBUG_LINK_FLAGS "${CMAKE_SHARED_LINKER_FLAGS_DEBUG}" CACHE STRING "Linker flags for debug libraries")
|
||||
endif(CMAKE_SHARED_LINKER_FLAGS_DEBUG)
|
||||
if(CMAKE_SHARED_LINKER_FLAGS_RELEASE)
|
||||
set(RELEASE_LINK_FLAGS "${CMAKE_SHARED_LINKER_FLAGS_RELEASE}" CACHE STRING "Link flags for release libraries")
|
||||
endif(CMAKE_SHARED_LINKER_FLAGS_RELEASE)
|
||||
|
||||
# Set DEBUG_EXE_LINK_FLAGS, RELEASE_EXE_LINK_FLAGS
|
||||
if (CMAKE_EXE_LINKER_FLAGS_DEBUG)
|
||||
set(DEBUG_EXE_LINK_FLAGS "${CMAKE_EXE_LINKER_FLAGS_DEBUG}")
|
||||
endif (CMAKE_EXE_LINKER_FLAGS_DEBUG)
|
||||
if (CMAKE_EXE_LINKER_FLAGS_RELEASE)
|
||||
set(RELEASE_EXE_LINK_FLAGS "${CMAKE_EXE_LINKER_FLAGS_RELEASE}")
|
||||
endif (CMAKE_EXE_LINKER_FLAGS_RELEASE)
|
||||
|
||||
# Tweak the configuration and build types appropriately.
|
||||
if(CMAKE_CONFIGURATION_TYPES)
|
||||
# Limit CMAKE_CONFIGURATION_TYPES to Debug and Release
|
||||
set(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "Semicolon-separate list of supported configuration types" FORCE)
|
||||
else(CMAKE_CONFIGURATION_TYPES)
|
||||
# Build in release mode by default
|
||||
if (NOT CMAKE_BUILD_TYPE)
|
||||
set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build, options are Release or Debug" FORCE)
|
||||
endif (NOT CMAKE_BUILD_TYPE)
|
||||
endif(CMAKE_CONFIGURATION_TYPES)
|
||||
|
||||
# Clear out the built-in C++ compiler and link flags for each of the
|
||||
# configurations.
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "" CACHE INTERNAL "Unused by Boost")
|
||||
set(CMAKE_SHARED_LINKER_FLAGS_DEBUG "" CACHE INTERNAL "Unused by Boost")
|
||||
set(CMAKE_MODULE_LINKER_FLAGS_DEBUG "" CACHE INTERNAL "Unused by Boost")
|
||||
set(CMAKE_EXE_LINKER_FLAGS_DEBUG "" CACHE INTERNAL "Unused by Boost")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "" CACHE INTERNAL "Unused by Boost")
|
||||
set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "" CACHE INTERNAL "Unused by Boost")
|
||||
set(CMAKE_MODULE_LINKER_FLAGS_RELEASE "" CACHE INTERNAL "Unused by Boost")
|
||||
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "" CACHE INTERNAL "Unused by Boost")
|
||||
set(CMAKE_CXX_FLAGS_MINSIZEREL "" CACHE INTERNAL "Unused by Boost")
|
||||
set(CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL "" CACHE INTERNAL "Unused by Boost")
|
||||
set(CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL "" CACHE INTERNAL "Unused by Boost")
|
||||
set(CMAKE_EXE_LINKER_FLAGS_MINSIZEREL "" CACHE INTERNAL "Unused by Boost")
|
||||
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}")
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,534 +0,0 @@
|
||||
##########################################################################
|
||||
# Boost Documentation Generation #
|
||||
##########################################################################
|
||||
# Copyright (C) 2008 Douglas Gregor <doug.gregor@gmail.com> #
|
||||
# #
|
||||
# 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 #
|
||||
##########################################################################
|
||||
# Important developer macros in this file: #
|
||||
# #
|
||||
##########################################################################
|
||||
|
||||
# Transforms the source XML file by applying the given XSL stylesheet.
|
||||
#
|
||||
# xsl_transform(output input [input2 input3 ...]
|
||||
# STYLESHEET stylesheet
|
||||
# [CATALOG catalog]
|
||||
# [DIRECTORY mainfile]
|
||||
# [PARAMETERS param1=value1 param2=value2 ...]
|
||||
# [[MAKE_ALL_TARGET | MAKE_TARGET] target]
|
||||
# [COMMENT comment])
|
||||
#
|
||||
# This macro builds a custom command that transforms an XML file
|
||||
# (input) via the given XSL stylesheet. The output will either be a
|
||||
# single file (the default) or a directory (if the DIRECTION argument
|
||||
# is specified). The STYLESBEET stylesheet must be a valid XSL
|
||||
# stylesheet. Any extra input files will be used as additional
|
||||
# dependencies for the target. For example, these extra input files
|
||||
# might refer to other XML files that are included by the input file
|
||||
# through XInclude.
|
||||
#
|
||||
# When the XSL transform output is going to a directory, the mainfile
|
||||
# argument provides the name of a file that will be generated within
|
||||
# the output directory. This file will be used for dependency tracking.
|
||||
#
|
||||
# XML catalogs can be used to remap parts of URIs within the
|
||||
# stylesheet to other (typically local) entities. To provide an XML
|
||||
# catalog file, specify the name of the XML catalog file via the
|
||||
# CATALOG argument. It will be provided to the XSL transform.
|
||||
#
|
||||
# The PARAMETERS argument is followed by param=value pairs that set
|
||||
# additional parameters to the XSL stylesheet. The parameter names
|
||||
# that can be used correspond to the <xsl:param> elements within the
|
||||
# stylesheet.
|
||||
#
|
||||
# To associate a target name with the result of the XSL
|
||||
# transformation, use the MAKE_TARGET or MAKE_ALL_TARGET option and
|
||||
# provide the name of the target. The MAKE_ALL_TARGET option only
|
||||
# differs from MAKE_TARGET in that MAKE_ALL_TARGET will make the
|
||||
# resulting target a part of the default build.
|
||||
#
|
||||
# If a COMMENT argument is provided, it will be used as the comment
|
||||
# CMake provides when running this XSL transformation. Otherwise, the
|
||||
# comment will be "Generating "output" via XSL transformation...".
|
||||
macro(xsl_transform OUTPUT INPUT)
|
||||
parse_arguments(THIS_XSL
|
||||
"STYLESHEET;CATALOG;MAKE_ALL_TARGET;MAKE_TARGET;PARAMETERS;DIRECTORY;COMMENT"
|
||||
""
|
||||
${ARGN}
|
||||
)
|
||||
|
||||
# TODO: Is this the best way to handle catalogs? The alternative is
|
||||
# that we could provide explicit remappings to the xsl_transform
|
||||
# macro, and it could generate a temporary XML catalog file.
|
||||
if (THIS_XSL_CATALOG)
|
||||
set(THIS_XSL_CATALOG "XML_CATALOG_FILES=${THIS_XSL_CATALOG}")
|
||||
endif ()
|
||||
|
||||
# Translate XSL parameters into a form that xsltproc can use.
|
||||
set(THIS_XSL_EXTRA_FLAGS)
|
||||
foreach(PARAM ${THIS_XSL_PARAMETERS})
|
||||
string(REGEX REPLACE "([^=]*)=([^;]*)" "\\1;\\2"
|
||||
XSL_PARAM_LIST ${PARAM})
|
||||
list(GET XSL_PARAM_LIST 0 XSL_PARAM_NAME)
|
||||
list(GET XSL_PARAM_LIST 1 XSL_PARAM_VALUE)
|
||||
list(APPEND THIS_XSL_EXTRA_FLAGS
|
||||
--stringparam ${XSL_PARAM_NAME} ${XSL_PARAM_VALUE})
|
||||
endforeach(PARAM)
|
||||
|
||||
# If the user didn't provide a comment for this transformation,
|
||||
# create a default one.
|
||||
if(NOT THIS_XSL_COMMENT)
|
||||
set(THIS_XSL_COMMENT "Generating ${OUTPUT} via XSL transformation...")
|
||||
endif()
|
||||
|
||||
# Figure out the actual output file that we tell CMake about
|
||||
# (THIS_XSL_OUTPUT_FILE) and the output file or directory that we
|
||||
# tell xsltproc about (THIS_XSL_OUTPUT).
|
||||
if (THIS_XSL_DIRECTORY)
|
||||
set(THIS_XSL_OUTPUT_FILE ${OUTPUT}/${THIS_XSL_DIRECTORY})
|
||||
set(THIS_XSL_OUTPUT ${OUTPUT}/)
|
||||
else()
|
||||
set(THIS_XSL_OUTPUT_FILE ${OUTPUT})
|
||||
set(THIS_XSL_OUTPUT ${OUTPUT})
|
||||
endif()
|
||||
|
||||
if(NOT THIS_XSL_STYLESHEET)
|
||||
message(SEND_ERROR
|
||||
"xsl_transform macro invoked without a STYLESHEET argument")
|
||||
else()
|
||||
# Run the XSLT processor to do the XML transformation.
|
||||
add_custom_command(OUTPUT ${THIS_XSL_OUTPUT_FILE}
|
||||
COMMAND ${THIS_XSL_CATALOG} ${XSLTPROC} ${XSLTPROC_FLAGS}
|
||||
${THIS_XSL_EXTRA_FLAGS} -o ${THIS_XSL_OUTPUT}
|
||||
--path ${CMAKE_CURRENT_BINARY_DIR}
|
||||
${THIS_XSL_STYLESHEET} ${INPUT}
|
||||
COMMENT ${THIS_XSL_COMMENT}
|
||||
DEPENDS ${INPUT} ${THIS_XSL_DEFAULT_ARGS})
|
||||
set_source_files_properties(${THIS_XSL_OUTPUT_FILE}
|
||||
PROPERTIES GENERATED TRUE)
|
||||
|
||||
# Create a custom target to refer to the result of this
|
||||
# transformation.
|
||||
if (THIS_XSL_MAKE_ALL_TARGET)
|
||||
add_custom_target(${THIS_XSL_MAKE_ALL_TARGET} ALL
|
||||
DEPENDS ${THIS_XSL_OUTPUT_FILE})
|
||||
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)
|
||||
|
||||
# Use Doxygen to parse header files and produce BoostBook output.
|
||||
#
|
||||
# doxygen_to_boostbook(output header1 header2 ...
|
||||
# [PARAMETERS param1=value1 param2=value2 ... ])
|
||||
#
|
||||
# This macro sets up rules to transform a set of C/C++ header files
|
||||
# into BoostBook reference documentation. The resulting BoostBook XML
|
||||
# file will be named by the "output" parameter, and the set of headers
|
||||
# is provided following the output file. The actual parsing of header
|
||||
# files is provided by Doxygen, and is transformed into XML through
|
||||
# various XSLT transformations.
|
||||
#
|
||||
# Doxygen has a variety of configuration parameters. One can supply
|
||||
# extra Doxygen configuration parameters by providing NAME=VALUE pairs
|
||||
# following the PARAMETERS argument. These parameters will be added to
|
||||
# the Doxygen configuration file.
|
||||
#
|
||||
# This macro is intended to be used internally by
|
||||
# boost_add_documentation.
|
||||
macro(doxygen_to_boostbook OUTPUT)
|
||||
parse_arguments(THIS_DOXY
|
||||
"PARAMETERS"
|
||||
""
|
||||
${ARGN})
|
||||
|
||||
# Create a Doxygen configuration file template
|
||||
# TODO: We would like to create this file at build time rather
|
||||
# than at configuration time
|
||||
get_filename_component(DOXYFILE_PATH ${OUTPUT} PATH)
|
||||
get_filename_component(DOXYFILE_NAME ${OUTPUT} NAME_WE)
|
||||
set(DOXYFILE ${DOXYFILE_PATH}/${DOXYFILE_NAME}.doxyfile)
|
||||
execute_process(
|
||||
COMMAND ${DOXYGEN} -s -g ${DOXYFILE}
|
||||
OUTPUT_QUIET ERROR_QUIET)
|
||||
|
||||
# Update the Doxygen configuration file for XML generation
|
||||
file(APPEND ${DOXYFILE} "OUTPUT_DIRECTORY = ${CMAKE_CURRENT_BINARY_DIR}\n")
|
||||
file(APPEND ${DOXYFILE} "GENERATE_LATEX = NO\n")
|
||||
file(APPEND ${DOXYFILE} "GENERATE_HTML = NO\n")
|
||||
file(APPEND ${DOXYFILE} "GENERATE_XML = YES\n")
|
||||
foreach(PARAM ${THIS_DOXY_PARAMETERS})
|
||||
file(APPEND ${DOXYFILE} "${PARAM}\n")
|
||||
endforeach(PARAM)
|
||||
|
||||
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})
|
||||
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)
|
||||
file(APPEND ${DOXYFILE} "INPUT = ${THIS_DOXY_HEADER_LIST}\n")
|
||||
|
||||
# Generate Doxygen XML
|
||||
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/xml/index.xml
|
||||
COMMAND ${DOXYGEN} ${DOXYFILE}
|
||||
COMMENT "Generating Doxygen XML output for Boost.${PROJECT_NAME}..."
|
||||
DEPENDS ${THIS_DOXY_HEADERS})
|
||||
|
||||
# Collect Doxygen XML into a single XML file
|
||||
set_source_files_properties(
|
||||
${CMAKE_CURRENT_BINARY_DIR}/xml/combine.xslt
|
||||
PROPERTIES GENERATED TRUE)
|
||||
xsl_transform(
|
||||
${CMAKE_CURRENT_BINARY_DIR}/xml/all.xml
|
||||
${CMAKE_CURRENT_BINARY_DIR}/xml/index.xml
|
||||
STYLESHEET ${CMAKE_CURRENT_BINARY_DIR}/xml/combine.xslt
|
||||
COMMENT "Collecting Doxygen XML output for Boost.${PROJECT_NAME}...")
|
||||
|
||||
# Transform single Doxygen XML file into BoostBook XML
|
||||
xsl_transform(${OUTPUT}
|
||||
${CMAKE_CURRENT_BINARY_DIR}/xml/all.xml
|
||||
STYLESHEET ${BOOSTBOOK_XSL_DIR}/doxygen/doxygen2boostbook.xsl
|
||||
COMMENT "Transforming Doxygen XML into BoostBook XML for Boost.${PROJECT_NAME}...")
|
||||
endmacro(doxygen_to_boostbook)
|
||||
|
||||
# Adds documentation for the current library or tool project
|
||||
#
|
||||
# boost_add_documentation(source1 source2 source3 ...
|
||||
# [HEADERS header1 header2 ...]
|
||||
# [DOXYGEN_PARAMETERS param1=value1 param2=value2 ...])
|
||||
#
|
||||
|
||||
# This macro describes the documentation for a library or tool, which
|
||||
# will be built and installed as part of the normal build
|
||||
# process. Documentation can be in a variety of formats, and the input
|
||||
# format will determine how that documentation is transformed. The
|
||||
# documentation's format is determined by its extension, and the
|
||||
# following input formats are supported:
|
||||
#
|
||||
# QuickBook
|
||||
# BoostBook (.XML extension):
|
||||
macro(boost_add_documentation SOURCE)
|
||||
parse_arguments(THIS_DOC
|
||||
"HEADERS;DOXYGEN_PARAMETERS"
|
||||
""
|
||||
${ARGN})
|
||||
|
||||
# If SOURCE is not a full path, it's in the current source
|
||||
# directory.
|
||||
get_filename_component(THIS_DOC_SOURCE_PATH ${SOURCE} PATH)
|
||||
if(THIS_DOC_SOURCE_PATH STREQUAL "")
|
||||
set(THIS_DOC_SOURCE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/${SOURCE}")
|
||||
else()
|
||||
set(THIS_DOC_SOURCE_PATH ${SOURCE})
|
||||
endif()
|
||||
|
||||
# If we are parsing C++ headers (with Doxygen) for reference
|
||||
# documentation, do so now and produce the requested BoostBook XML
|
||||
# file.
|
||||
if (THIS_DOC_HEADERS)
|
||||
set(DOC_HEADER_FILES)
|
||||
set(DOC_BOOSTBOOK_FILE)
|
||||
foreach(HEADER ${THIS_DOC_HEADERS})
|
||||
get_filename_component(HEADER_EXT ${HEADER} EXT)
|
||||
string(TOUPPER ${HEADER_EXT} HEADER_EXT)
|
||||
if (HEADER_EXT STREQUAL ".XML")
|
||||
if (DOC_BOOSTBOOK_FILE)
|
||||
# Generate this BoostBook file from the headers
|
||||
doxygen_to_boostbook(
|
||||
${CMAKE_CURRENT_BINARY_DIR}/${DOC_BOOSTBOOK_FILE}
|
||||
${DOC_HEADER_FILES}
|
||||
PARAMETERS ${THIS_DOC_DOXYGEN_PARAMETERS})
|
||||
list(APPEND THIS_DOC_DEFAULT_ARGS
|
||||
${CMAKE_CURRENT_BINARY_DIR}/${DOC_BOOSTBOOK_FILE})
|
||||
endif()
|
||||
set(DOC_BOOSTBOOK_FILE ${HEADER})
|
||||
set(DOC_HEADER_FILES)
|
||||
else()
|
||||
if (NOT DOC_BOOSTBOOK_FILE)
|
||||
message(SEND_ERROR
|
||||
"HEADERS argument to boost_add_documentation must start with a BoostBook XML file name for output")
|
||||
endif()
|
||||
list(APPEND DOC_HEADER_FILES ${HEADER})
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
if (DOC_HEADER_FILES)
|
||||
# Generate this BoostBook file from the headers
|
||||
doxygen_to_boostbook(
|
||||
${CMAKE_CURRENT_BINARY_DIR}/${DOC_BOOSTBOOK_FILE}
|
||||
${DOC_HEADER_FILES}
|
||||
PARAMETERS ${THIS_DOC_DOXYGEN_PARAMETERS})
|
||||
list(APPEND THIS_DOC_DEFAULT_ARGS
|
||||
${CMAKE_CURRENT_BINARY_DIR}/${DOC_BOOSTBOOK_FILE})
|
||||
|
||||
endif()
|
||||
endif (THIS_DOC_HEADERS)
|
||||
|
||||
# Figure out the source file extension, which will tell us how to
|
||||
# build the documentation.
|
||||
get_filename_component(THIS_DOC_EXT ${SOURCE} EXT)
|
||||
string(TOUPPER ${THIS_DOC_EXT} THIS_DOC_EXT)
|
||||
if (THIS_DOC_EXT STREQUAL ".QBK")
|
||||
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})
|
||||
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)
|
||||
set(DOCBOOK_FILE ${SOURCE_FILENAME}.docbook)
|
||||
xsl_transform(${DOCBOOK_FILE} ${THIS_DOC_SOURCE_PATH}
|
||||
${THIS_DOC_DEFAULT_ARGS}
|
||||
STYLESHEET ${BOOSTBOOK_XSL_DIR}/docbook.xsl
|
||||
CATALOG ${CMAKE_BINARY_DIR}/catalog.xml
|
||||
COMMENT "Generating DocBook documentation for Boost.${PROJECT_NAME}..."
|
||||
MAKE_TARGET ${PROJECT_NAME}-docbook)
|
||||
|
||||
# Transform DocBook into other formats
|
||||
boost_add_documentation(${CMAKE_CURRENT_BINARY_DIR}/${DOCBOOK_FILE})
|
||||
elseif(THIS_DOC_EXT STREQUAL ".DOCBOOK")
|
||||
# If requested, build HTML documentation
|
||||
if (BUILD_DOCUMENTATION_HTML)
|
||||
xsl_transform(
|
||||
${CMAKE_CURRENT_BINARY_DIR}/html
|
||||
${THIS_DOC_SOURCE_PATH}
|
||||
STYLESHEET ${BOOSTBOOK_XSL_DIR}/html.xsl
|
||||
CATALOG ${CMAKE_BINARY_DIR}/catalog.xml
|
||||
DIRECTORY HTML.manifest
|
||||
PARAMETERS admon.graphics.path=images
|
||||
navig.graphics.path=images
|
||||
boost.image.src=boost.png
|
||||
COMMENT "Generating HTML documentaiton for Boost.${PROJECT_NAME}..."
|
||||
MAKE_TARGET ${PROJECT_NAME}-html)
|
||||
|
||||
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
|
||||
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}
|
||||
COMPONENT ${ULIBNAME}_DOCS
|
||||
PATTERN "*.manifest" EXCLUDE)
|
||||
endif ()
|
||||
|
||||
# If requested, build Unix man pages
|
||||
if (BUILD_DOCUMENTATION_MAN_PAGES)
|
||||
xsl_transform(
|
||||
${CMAKE_CURRENT_BINARY_DIR}/man
|
||||
${THIS_DOC_SOURCE_PATH}
|
||||
STYLESHEET ${BOOSTBOOK_XSL_DIR}/manpages.xsl
|
||||
CATALOG ${CMAKE_BINARY_DIR}/catalog.xml
|
||||
DIRECTORY man.manifest
|
||||
COMMENT "Generating man pages for Boost.${PROJECT_NAME}..."
|
||||
MAKE_TARGET ${PROJECT_NAME}-man)
|
||||
|
||||
# Install man pages
|
||||
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/man
|
||||
DESTINATION .
|
||||
COMPONENT ${ULIBNAME}_DOCS
|
||||
PATTERN "*.manifest" EXCLUDE)
|
||||
endif ()
|
||||
else()
|
||||
message(SEND_ERROR "Unknown documentation source kind ${SOURCE}.")
|
||||
endif()
|
||||
endmacro(boost_add_documentation)
|
||||
|
||||
|
||||
##########################################################################
|
||||
# Documentation tools configuration #
|
||||
##########################################################################
|
||||
|
||||
# Downloads the DocBook DTD into a place where DOCBOOK_DTD_DIR can
|
||||
# find it.
|
||||
macro(download_docbook_dtd)
|
||||
if (NOT DOCBOOK_DTD_DIR)
|
||||
set(DOCBOOK_DTD_FILENAME "docbook-xml-${WANT_DOCBOOK_DTD_VERSION}.zip")
|
||||
set(DOCBOOK_DTD_URL
|
||||
"http://www.oasis-open.org/docbook/xml/${WANT_DOCBOOK_DTD_VERSION}/${DOCBOOK_DTD_FILENAME}")
|
||||
message(STATUS "Downloading DocBook DTD from ${DOCBOOK_DTD_URL}...")
|
||||
file(DOWNLOAD
|
||||
"${DOCBOOK_DTD_URL}"
|
||||
"${CMAKE_BINARY_DIR}/${DOCBOOK_DTD_FILENAME}"
|
||||
TIMEOUT 60 STATUS DOCBOOK_DTD_STATUS)
|
||||
list(GET DOCBOOK_DTD_STATUS 0 DOCBOOK_DTD_ERROR)
|
||||
if (DOCBOOK_DTD_ERROR EQUAL 0)
|
||||
# Download successful! Extract the DTD ZIP file.
|
||||
message(STATUS "Extracting DocBook DTD...")
|
||||
execute_process(
|
||||
COMMAND ${UNZIP} -d docbook-dtd-${WANT_DOCBOOK_DTD_VERSION} -q "${CMAKE_BINARY_DIR}/${DOCBOOK_DTD_FILENAME}"
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
||||
RESULT_VARIABLE UNZIP_DTD_RESULT)
|
||||
if (UNZIP_DTD_RESULT EQUAL 0)
|
||||
# Extraction successful. Cleanup the downloaded file.
|
||||
file(REMOVE ${CMAKE_BINARY_DIR}/${DOCBOOK_DTD_FILENAME})
|
||||
set(DOCBOOK_DTD_DIR
|
||||
${CMAKE_BINARY_DIR}/docbook-dtd-${WANT_DOCBOOK_DTD_VERSION}
|
||||
CACHE PATH "Path to the DocBook DTD" FORCE)
|
||||
else()
|
||||
# We failed: report the error to the user
|
||||
message(SEND_ERROR "Extraction of DocBook DTD archive ${DOCBOOK_DTD_FILENAME} failed with error \"${UNZIP_DTD_RESULT}\". DocBook DTD and XSL autoconfiguration cannot continue.")
|
||||
endif ()
|
||||
else()
|
||||
list(GET DOCBOOK_DTD_STATUS 1 DOCBOOK_DTD_ERRORMSG)
|
||||
message(SEND_ERROR "Unable to download DocBook DTD from ${DOCBOOK_DTD_URL}. Error was: \"${DOCBOOK_DTD_ERRORMSG}\"")
|
||||
endif()
|
||||
endif()
|
||||
endmacro(download_docbook_dtd)
|
||||
|
||||
# Downloads the DocBook XSL into a place where DOCBOOK_XSL_DIR can
|
||||
# find it.
|
||||
macro(download_docbook_xsl)
|
||||
if (NOT DOCBOOK_XSL_DIR)
|
||||
set(DOCBOOK_XSL_FILENAME "docbook-xsl-${WANT_DOCBOOK_XSL_VERSION}.zip")
|
||||
set(DOCBOOK_XSL_URL
|
||||
"${SOURCEFORGE_MIRROR}/sourceforge/docbook/${DOCBOOK_XSL_FILENAME}")
|
||||
message(STATUS "Downloading DocBook XSL from ${DOCBOOK_XSL_URL}...")
|
||||
file(DOWNLOAD
|
||||
"${DOCBOOK_XSL_URL}"
|
||||
"${CMAKE_BINARY_DIR}/${DOCBOOK_XSL_FILENAME}"
|
||||
TIMEOUT 60 STATUS DOCBOOK_XSL_STATUS)
|
||||
list(GET DOCBOOK_XSL_STATUS 0 DOCBOOK_XSL_ERROR)
|
||||
if (DOCBOOK_XSL_ERROR EQUAL 0)
|
||||
# Download successful! Extract the XSL ZIP file.
|
||||
message(STATUS "Extracting DocBook XSL stylesheets...")
|
||||
execute_process(
|
||||
COMMAND ${UNZIP} -q "${CMAKE_BINARY_DIR}/${DOCBOOK_XSL_FILENAME}"
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
||||
RESULT_VARIABLE UNZIP_XSL_RESULT)
|
||||
if (UNZIP_XSL_RESULT EQUAL 0)
|
||||
# Extraction successful. Clean up the downloaded file.
|
||||
file(REMOVE ${CMAKE_BINARY_DIR}/${DOCBOOK_XSL_FILENAME})
|
||||
set(DOCBOOK_XSL_DIR
|
||||
${CMAKE_BINARY_DIR}/docbook-xsl-${WANT_DOCBOOK_XSL_VERSION}
|
||||
CACHE PATH "Path to the DocBook XSL stylesheets" FORCE)
|
||||
else()
|
||||
# We failed: report the error to the user
|
||||
message(SEND_ERROR "Extraction of DocBook XSL archive ${DOCBOOK_XSL_FILENAME} failed with error \"${UNZIP_XSL_RESULT}\". DocBook XSL and XSL autoconfiguration cannot continue.")
|
||||
endif ()
|
||||
else()
|
||||
list(GET DOCBOOK_XSL_STATUS 1 DOCBOOK_XSL_ERRORMSG)
|
||||
message(SEND_ERROR "Unable to download DocBook XSL from ${DOCBOOK_XSL_URL}. Error was: \"${DOCBOOK_XSL_ERRORMSG}\". You might want to try another SourceForge mirror site by changing the advanced configuration variable SOURCEFORGE_MIRROR.")
|
||||
endif()
|
||||
endif()
|
||||
endmacro(download_docbook_xsl)
|
||||
|
||||
# Preferred versions of DocBook stylesheets and utilities. We don't
|
||||
# require these, but we know that they work.
|
||||
set(WANT_DOCBOOK_DTD_VERSION 4.2)
|
||||
set(WANT_DOCBOOK_XSL_VERSION 1.73.2)
|
||||
|
||||
# Find xsltproc to transform XML documents via XSLT
|
||||
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")
|
||||
|
||||
# Find the DocBook DTD (version 4.2)
|
||||
find_path(DOCBOOK_DTD_DIR docbookx.dtd
|
||||
PATHS "${CMAKE_BINARY_DIR}/docbook-dtd-${WANT_DOCBOOK_DTD_VERSION}"
|
||||
DOC "Path to the DocBook DTD")
|
||||
|
||||
# Find the DocBook XSL stylesheets
|
||||
find_path(DOCBOOK_XSL_DIR html/html.xsl
|
||||
PATHS "${CMAKE_BINARY_DIR}/docbook-xsl-${WANT_DOCBOOK_XSL_VERSION}"
|
||||
DOC "Path to the DocBook XSL stylesheets")
|
||||
|
||||
# Find the BoostBook DTD (it should be in the distribution!)
|
||||
find_path(BOOSTBOOK_DTD_DIR boostbook.dtd
|
||||
PATHS ${CMAKE_SOURCE_DIR}/tools/boostbook/dtd
|
||||
DOC "Path to the BoostBook DTD")
|
||||
mark_as_advanced(BOOSTBOOK_DTD_DIR)
|
||||
|
||||
# Find the BoostBook XSL stylesheets (they should be in the distribution!)
|
||||
find_path(BOOSTBOOK_XSL_DIR docbook.xsl
|
||||
PATHS ${CMAKE_SOURCE_DIR}/tools/boostbook/xsl
|
||||
DOC "Path to the BoostBook XSL stylesheets")
|
||||
mark_as_advanced(BOOSTBOOK_XSL_DIR)
|
||||
|
||||
# Try to find Doxygen
|
||||
find_package(Doxygen)
|
||||
|
||||
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)
|
||||
option(BUILD_DOCUMENTATION_MAN_PAGES "Whether to build Unix man pages" ON)
|
||||
|
||||
# Generate an XML catalog file.
|
||||
configure_file(${CMAKE_SOURCE_DIR}/tools/build/CMake/catalog.xml.in
|
||||
${CMAKE_BINARY_DIR}/catalog.xml
|
||||
@ONLY)
|
||||
else()
|
||||
# Look for "unzip", because we'll need it to download the DocBook
|
||||
# DTD and XSL stylesheets as part of autoconfiguration.
|
||||
find_program(UNZIP unzip DOC "Used to extract ZIP archives")
|
||||
|
||||
if (UNZIP)
|
||||
option(DOCBOOK_AUTOCONFIG
|
||||
"Automatically download and configure DocBook DTD and XSL" OFF)
|
||||
set(SOURCEFORGE_MIRROR "http://dl.sourceforge.net"
|
||||
CACHE STRING "SourceForge mirror used to download DocBook XSL during autoconfiguration")
|
||||
mark_as_advanced(SOURCEFORGE_MIRROR)
|
||||
if (DOCBOOK_AUTOCONFIG)
|
||||
message(STATUS "Initiating DocBook DTD and XSL autoconfiguration...")
|
||||
download_docbook_dtd()
|
||||
download_docbook_xsl()
|
||||
endif (DOCBOOK_AUTOCONFIG)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Turn off BUILD_DOCUMENTATION if it isn't going to succeed.
|
||||
if (BUILD_DOCUMENTATION)
|
||||
set(BUILD_DOCUMENTATION_OKAY TRUE)
|
||||
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()
|
||||
|
||||
if (NOT BUILD_DOCUMENTATION_OKAY)
|
||||
if (BUILD_DOCUMENTATION)
|
||||
set(BUILD_DOCUMENTATION OFF CACHE BOOL
|
||||
"Whether to build library documentation" FORCE)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
@@ -1,453 +0,0 @@
|
||||
##########################################################################
|
||||
# Regression Testing Support for Boost #
|
||||
##########################################################################
|
||||
# Copyright (C) 2007-8 Douglas Gregor <doug.gregor@gmail.com> #
|
||||
# Copyright (C) 2007-8 Troy D. 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 #
|
||||
##########################################################################
|
||||
# This file provides a set of CMake macros that support regression
|
||||
# testing for Boost libraries. For each of the test macros below, the
|
||||
# first argument, testname, states the name of the test that will be
|
||||
# created. If no other arguments are provided, the source file
|
||||
# testname.cpp will be used as the source file; otherwise, source
|
||||
# files should be listed immediately after the name of the test.
|
||||
#
|
||||
# The macros for creating regression tests are:
|
||||
# boost_test_run: Builds an executable and runs it as a test. The test
|
||||
# succeeds if it builds and returns 0 when executed.
|
||||
#
|
||||
# boost_test_run_fail: Builds an executable and runs it as a test. The
|
||||
# test succeeds if it builds but returns a non-zero
|
||||
# exit code when executed.
|
||||
#
|
||||
# boost_test_compile: Tests that the given source file compiles without
|
||||
# any errors.
|
||||
#
|
||||
# boost_test_compile_fail: Tests that the given source file produces
|
||||
# errors when compiled.
|
||||
#
|
||||
# boost_additional_test_dependencies: Adds needed include directories for
|
||||
# the tests.
|
||||
|
||||
# User-controlled option that can be used to enable/disable regression
|
||||
# testing. By default, we disable testing, because most users won't
|
||||
# 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_REGRESSION_TESTS "Enable regression testing" OFF)
|
||||
|
||||
if (BUILD_REGRESSION_TESTS)
|
||||
enable_testing()
|
||||
mark_as_advanced(BUILD_TESTING)
|
||||
|
||||
option(TEST_INSTALLED_TREE "Enable testing of an already-installed tree" OFF)
|
||||
|
||||
set(BOOST_TEST_LIBRARIES ""
|
||||
CACHE STRING "Semicolon-separated list of Boost libraries to test")
|
||||
|
||||
if (TEST_INSTALLED_TREE)
|
||||
include("${CMAKE_INSTALL_PREFIX}/lib/Boost${BOOST_VERSION}/boost-targets.cmake")
|
||||
endif (TEST_INSTALLED_TREE)
|
||||
|
||||
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
|
||||
# the library being tested 'libname' and all of its dependencies.
|
||||
#
|
||||
# boost_additional_test_dependencies(libname
|
||||
# BOOST_DEPENDS libdepend1 libdepend2 ...)
|
||||
#
|
||||
# libname is the name of the boost library being tested. (signals)
|
||||
#
|
||||
# There is mandatory argument to the macro:
|
||||
#
|
||||
# BOOST_DEPENDS: The list of the extra boost libraries that the test suite will
|
||||
# depend on. You do NOT have to list those libraries already listed by the
|
||||
# module.cmake file as these will be used.
|
||||
#
|
||||
#
|
||||
# example usage:
|
||||
# boost_additional_test_dependencies(signals BOOST_DEPENDS test optional)
|
||||
#
|
||||
macro(boost_additional_test_dependencies libname)
|
||||
parse_arguments(BOOST_TEST
|
||||
"BOOST_DEPENDS"
|
||||
""
|
||||
${ARGN}
|
||||
)
|
||||
# Get the list of libraries that this test depends on
|
||||
# Set THIS_PROJECT_DEPENDS_ALL to the set of all of its
|
||||
# dependencies, its dependencies' dependencies, etc., transitively.
|
||||
string(TOUPPER "BOOST_${libname}_DEPENDS" THIS_PROJECT_DEPENDS)
|
||||
set(THIS_TEST_DEPENDS_ALL ${libname} ${${THIS_PROJECT_DEPENDS}} )
|
||||
set(ADDED_DEPS TRUE)
|
||||
while (ADDED_DEPS)
|
||||
set(ADDED_DEPS FALSE)
|
||||
foreach(DEP ${THIS_TEST_DEPENDS_ALL})
|
||||
string(TOUPPER "BOOST_${DEP}_DEPENDS" DEP_DEPENDS)
|
||||
foreach(DEPDEP ${${DEP_DEPENDS}})
|
||||
list(FIND THIS_TEST_DEPENDS_ALL ${DEPDEP} DEPDEP_INDEX)
|
||||
if (DEPDEP_INDEX EQUAL -1)
|
||||
list(APPEND THIS_TEST_DEPENDS_ALL ${DEPDEP})
|
||||
set(ADDED_DEPS TRUE)
|
||||
endif()
|
||||
endforeach()
|
||||
endforeach()
|
||||
endwhile()
|
||||
|
||||
# Get the list of dependencies for the additional libraries arguments
|
||||
foreach(additional_lib ${BOOST_TEST_BOOST_DEPENDS})
|
||||
list(FIND THIS_TEST_DEPENDS_ALL ${additional_lib} DEPDEP_INDEX)
|
||||
if (DEPDEP_INDEX EQUAL -1)
|
||||
list(APPEND THIS_TEST_DEPENDS_ALL ${additional_lib})
|
||||
set(ADDED_DEPS TRUE)
|
||||
endif()
|
||||
string(TOUPPER "BOOST_${additional_lib}_DEPENDS" THIS_PROJECT_DEPENDS)
|
||||
set(ADDED_DEPS TRUE)
|
||||
while (ADDED_DEPS)
|
||||
set(ADDED_DEPS FALSE)
|
||||
foreach(DEP ${THIS_TEST_DEPENDS_ALL})
|
||||
string(TOUPPER "BOOST_${DEP}_DEPENDS" DEP_DEPENDS)
|
||||
foreach(DEPDEP ${${DEP_DEPENDS}})
|
||||
list(FIND THIS_TEST_DEPENDS_ALL ${DEPDEP} DEPDEP_INDEX)
|
||||
if (DEPDEP_INDEX EQUAL -1)
|
||||
list(APPEND THIS_TEST_DEPENDS_ALL ${DEPDEP})
|
||||
set(ADDED_DEPS TRUE)
|
||||
endif()
|
||||
endforeach()
|
||||
endforeach()
|
||||
endwhile()
|
||||
endforeach()
|
||||
|
||||
foreach (include ${THIS_TEST_DEPENDS_ALL})
|
||||
include_directories("${Boost_SOURCE_DIR}/libs/${include}/include")
|
||||
endforeach (include ${includes})
|
||||
|
||||
endmacro(boost_additional_test_dependencies libname)
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# This macro is an internal utility macro that helps parse the
|
||||
# arguments passed to the Boost testing commands. It will generally
|
||||
# not be used by Boost developers.
|
||||
#
|
||||
# boost_test_parse_args(testname
|
||||
# [source1 source2 ...]
|
||||
# [ARGS arg1 arg2... ]
|
||||
# [COMPILE_FLAGS compileflags]
|
||||
# [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
|
||||
# this macro will be parsed and categorized for the developer-level
|
||||
# test macros to use.
|
||||
#
|
||||
# Variables affected:
|
||||
#
|
||||
# BOOST_TEST_OKAY: Will be set to TRUE if it is okay to build and
|
||||
# run this test.
|
||||
#
|
||||
# BOOST_TEST_SOURCES: Will be populated with the set of source files
|
||||
# that should be used to compile this test. If the user has provided
|
||||
# source files, BOOST_TEST_SOURCES will contain those; otherwise,
|
||||
# BOOST_TEST_SOURCES will only contain "testname.cpp".
|
||||
#
|
||||
# BOOST_TEST_TESTNAME: A (hopefully) globally unique target name
|
||||
# for the test, constructed from PROJECT-testname-TAG
|
||||
#
|
||||
# BOOST_TEST_arg: Will be populated with the arguments provided for
|
||||
# the arguemnt "arg", where "arg" can be any of the extra arguments
|
||||
# specified above.
|
||||
#
|
||||
#
|
||||
macro(boost_test_parse_args testname)
|
||||
#message("boost_test_parse_args ${testname} ${ARGN}")
|
||||
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;KNOWN_FAILURES"
|
||||
"COMPILE;RUN;LINK;FAIL;RELEASE;DEBUG"
|
||||
${ARGN}
|
||||
)
|
||||
|
||||
# Check each of the dependencies to see if we can still build this
|
||||
# test.
|
||||
foreach(ARG ${BOOST_TEST_DEPENDS})
|
||||
get_target_property(DEPEND_TYPE ${ARG} TYPE)
|
||||
get_target_property(DEPEND_LOCATION ${ARG} LOCATION)
|
||||
# If building static libraries is turned off, don't try to build
|
||||
# the test
|
||||
if (NOT BUILD_STATIC AND ${DEPEND_TYPE} STREQUAL "STATIC_LIBRARY")
|
||||
set(BOOST_TEST_OKAY FALSE)
|
||||
endif (NOT BUILD_STATIC AND ${DEPEND_TYPE} STREQUAL "STATIC_LIBRARY")
|
||||
|
||||
# If building shared libraries is turned off, don't try to build
|
||||
# the test
|
||||
if (NOT BUILD_SHARED AND ${DEPEND_TYPE} STREQUAL "SHARED_LIBRARY")
|
||||
set(BOOST_TEST_OKAY FALSE)
|
||||
endif (NOT BUILD_SHARED AND ${DEPEND_TYPE} STREQUAL "SHARED_LIBRARY")
|
||||
endforeach(ARG ${BOOST_TEST_DEPENDS})
|
||||
|
||||
# Setup the SOURCES variables. If no sources are specified, use the
|
||||
# name of the test.cpp
|
||||
if (BOOST_TEST_DEFAULT_ARGS)
|
||||
set(BOOST_TEST_SOURCES ${BOOST_TEST_DEFAULT_ARGS})
|
||||
else (BOOST_TEST_DEFAULT_ARGS)
|
||||
set(BOOST_TEST_SOURCES "${testname}.cpp")
|
||||
endif (BOOST_TEST_DEFAULT_ARGS)
|
||||
|
||||
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_REGRESSION_TESTS)
|
||||
set(BOOST_TEST_OKAY FALSE)
|
||||
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.
|
||||
#
|
||||
# boost_test_run(testname
|
||||
# [source1 source2 ...]
|
||||
# [ARGS arg1 arg2... ]
|
||||
# [COMPILE_FLAGS compileflags]
|
||||
# [LINK_FLAGS linkflags]
|
||||
# [LINK_LIBS linklibs]
|
||||
# [DEPENDS libdepend1 libdepend2 ...]
|
||||
# [EXTRA_OPTIONS option1 option2 ...])
|
||||
#
|
||||
# testname is the name of the test. source1, source2, etc. are the
|
||||
# source files that will be built and linked into the test
|
||||
# executable. If no source files are provided, the file "testname.cpp"
|
||||
# will be used instead.
|
||||
#
|
||||
# There are several optional arguments to control how the regression
|
||||
# test is built and executed:
|
||||
#
|
||||
# ARGS: Provides additional arguments that will be passed to the
|
||||
# test executable when it is run.
|
||||
#
|
||||
# COMPILE_FLAGS: Provides additional compilation flags that will be
|
||||
# used when building this test. For example, one might want to add
|
||||
# "-DBOOST_SIGNALS_ASSERT=1" to turn on assertions within the library.
|
||||
#
|
||||
# LINK_FLAGS: Provides additional flags that will be passed to the
|
||||
# linker when linking the test excecutable. This option should not
|
||||
# be used to link in additional libraries; see LINK_LIBS and
|
||||
# DEPENDS.
|
||||
#
|
||||
# LINK_LIBS: Provides additional libraries against which the test
|
||||
# executable will be linked. For example, one might provide "expat"
|
||||
# as options to LINK_LIBS, to state that this executable should be
|
||||
# linked against the external "expat" library. Use LINK_LIBS for
|
||||
# libraries external to Boost; for Boost libraries, use DEPENDS.
|
||||
#
|
||||
# DEPENDS: States that this test executable depends on and links
|
||||
# against another Boost library. The argument to DEPENDS should be
|
||||
# the name of a particular variant of a Boost library, e.g.,
|
||||
# boost_signals-static.
|
||||
#
|
||||
# EXTRA_OPTIONS: Provide extra options that will be passed on to
|
||||
# boost_add_executable.
|
||||
#
|
||||
# Example:
|
||||
# boost_test_run(signal_test DEPENDS boost_signals)
|
||||
macro(boost_test_run testname)
|
||||
boost_test_parse_args(${testname} ${ARGN} RUN)
|
||||
if (BOOST_TEST_OKAY)
|
||||
boost_add_executable(${testname} ${BOOST_TEST_SOURCES}
|
||||
OUTPUT_NAME tests/${PROJECT_NAME}/${testname}
|
||||
DEPENDS "${BOOST_TEST_DEPENDS}"
|
||||
LINK_LIBS ${BOOST_TEST_LINK_LIBS}
|
||||
LINK_FLAGS ${BOOST_TEST_LINK_FLAGS}
|
||||
COMPILE_FLAGS ${BOOST_TEST_COMPILE_FLAGS}
|
||||
NO_INSTALL
|
||||
${BOOST_TEST_EXTRA_OPTIONS})
|
||||
|
||||
if (THIS_EXE_OKAY)
|
||||
get_target_property(THIS_TEST_OUTPUT_DIRECTORY ${testname}
|
||||
RUNTIME_OUTPUT_DIRECTORY)
|
||||
add_test (${BOOST_TEST_TESTNAME}
|
||||
${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${CMAKE_CFG_INTDIR}/tests/${PROJECT_NAME}/${testname}
|
||||
${BOOST_TEST_ARGS})
|
||||
|
||||
set_tests_properties(${BOOST_TEST_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)
|
||||
endif ()
|
||||
endif(THIS_EXE_OKAY)
|
||||
endif (BOOST_TEST_OKAY)
|
||||
endmacro(boost_test_run)
|
||||
|
||||
#
|
||||
# This macro creates a boost regression test that will be run but is
|
||||
# expected to fail (exit with nonzero return code).
|
||||
# See boost_test_run()
|
||||
#
|
||||
macro(boost_test_run_fail testname)
|
||||
boost_test_run(${testname} ${ARGN} FAIL)
|
||||
endmacro(boost_test_run_fail)
|
||||
|
||||
# This macro creates a Boost regression test that will be compiled,
|
||||
# but not linked or executed. If the test can be compiled with no
|
||||
# failures, the test passes.
|
||||
#
|
||||
# boost_test_compile(testname
|
||||
# [source1]
|
||||
# [COMPILE_FLAGS compileflags])
|
||||
#
|
||||
# testname is the name of the test. source1 is the name of the source
|
||||
# file that will be built. If no source file is provided, the file
|
||||
# "testname.cpp" will be used instead.
|
||||
#
|
||||
# The COMPILE_FLAGS argument provides additional arguments that will
|
||||
# be passed to the compiler when building this test.
|
||||
|
||||
# Example:
|
||||
# boost_test_compile(advance)
|
||||
macro(boost_test_compile testname)
|
||||
boost_test_parse_args(${testname} ${ARGN} COMPILE)
|
||||
|
||||
set (test_pass "PASSED")
|
||||
if (BOOST_TEST_FAIL)
|
||||
set (test_pass "FAILED")
|
||||
endif(BOOST_TEST_FAIL)
|
||||
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}
|
||||
--build-and-test
|
||||
${Boost_SOURCE_DIR}/tools/build/CMake/CompileTest
|
||||
${Boost_BINARY_DIR}/tools/build/CMake/CompileTest
|
||||
--build-generator ${CMAKE_GENERATOR}
|
||||
--build-makeprogram ${CMAKE_MAKE_PROGRAM}
|
||||
--build-project CompileTest
|
||||
--build-options
|
||||
"-DSOURCE:STRING=${CMAKE_CURRENT_SOURCE_DIR}/${BOOST_TEST_SOURCES}"
|
||||
"-DINCLUDES:STRING=${BOOST_TEST_INCLUDES}"
|
||||
"-DCOMPILE_FLAGS:STRING=${BOOST_TEST_COMPILE_FLAGS}"
|
||||
)
|
||||
|
||||
set_tests_properties(${BOOST_TEST_TESTNAME}
|
||||
PROPERTIES
|
||||
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 ()
|
||||
endif(BOOST_TEST_OKAY)
|
||||
endmacro(boost_test_compile)
|
||||
|
||||
#
|
||||
# This macro creates a Boost regression test that is expected to
|
||||
# *fail* to compile. See boost_test_compile()
|
||||
#
|
||||
macro(boost_test_compile_fail testname)
|
||||
boost_test_compile(${testname} ${ARGN} FAIL)
|
||||
endmacro(boost_test_compile_fail)
|
||||
|
||||
|
||||
|
||||
|
||||
#
|
||||
# boost_test_link:
|
||||
#
|
||||
#
|
||||
# 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}
|
||||
PROPERTIES
|
||||
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 ()
|
||||
endif(BOOST_TEST_OKAY)
|
||||
endmacro(boost_test_link)
|
||||
|
||||
@@ -1,227 +0,0 @@
|
||||
##########################################################################
|
||||
# Boost Utilities #
|
||||
##########################################################################
|
||||
# Copyright (C) 2007 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 #
|
||||
##########################################################################
|
||||
# Macros in this module: #
|
||||
# #
|
||||
# list_contains: Determine whether a string value is in a list. #
|
||||
# #
|
||||
# car: Return the first element in a list #
|
||||
# #
|
||||
# cdr: Return all but the first element in a list #
|
||||
# #
|
||||
# parse_arguments: Parse keyword arguments for use in other macros. #
|
||||
##########################################################################
|
||||
|
||||
# This utility macro determines whether a particular string value
|
||||
# occurs within a list of strings:
|
||||
#
|
||||
# list_contains(result string_to_find arg1 arg2 arg3 ... argn)
|
||||
#
|
||||
# This macro sets the variable named by result equal to TRUE if
|
||||
# string_to_find is found anywhere in the following arguments.
|
||||
macro(list_contains var value)
|
||||
set(${var})
|
||||
foreach (value2 ${ARGN})
|
||||
if (${value} STREQUAL ${value2})
|
||||
set(${var} TRUE)
|
||||
endif (${value} STREQUAL ${value2})
|
||||
endforeach (value2)
|
||||
endmacro(list_contains)
|
||||
|
||||
# This utility macro extracts the first argument from the list of
|
||||
# arguments given, and places it into the variable named var.
|
||||
#
|
||||
# car(var arg1 arg2 ...)
|
||||
macro(car var)
|
||||
set(${var} ${ARGV1})
|
||||
endmacro(car)
|
||||
|
||||
# This utility macro extracts all of the arguments given except the
|
||||
# first, and places them into the variable named var.
|
||||
#
|
||||
# car(var arg1 arg2 ...)
|
||||
macro(cdr var junk)
|
||||
set(${var} ${ARGN})
|
||||
endmacro(cdr)
|
||||
|
||||
# The PARSE_ARGUMENTS macro will take the arguments of another macro and
|
||||
# define several variables. The first argument to PARSE_ARGUMENTS is a
|
||||
# prefix to put on all variables it creates. The second argument is a
|
||||
# list of names, and the third argument is a list of options. Both of
|
||||
# these lists should be quoted. The rest of PARSE_ARGUMENTS are
|
||||
# arguments from another macro to be parsed.
|
||||
#
|
||||
# PARSE_ARGUMENTS(prefix arg_names options arg1 arg2...)
|
||||
#
|
||||
# For each item in options, PARSE_ARGUMENTS will create a variable with
|
||||
# that name, prefixed with prefix_. So, for example, if prefix is
|
||||
# MY_MACRO and options is OPTION1;OPTION2, then PARSE_ARGUMENTS will
|
||||
# create the variables MY_MACRO_OPTION1 and MY_MACRO_OPTION2. These
|
||||
# variables will be set to true if the option exists in the command line
|
||||
# or false otherwise.
|
||||
#
|
||||
# For each item in arg_names, PARSE_ARGUMENTS will create a variable
|
||||
# with that name, prefixed with prefix_. Each variable will be filled
|
||||
# with the arguments that occur after the given arg_name is encountered
|
||||
# up to the next arg_name or the end of the arguments. All options are
|
||||
# removed from these lists. PARSE_ARGUMENTS also creates a
|
||||
# prefix_DEFAULT_ARGS variable containing the list of all arguments up
|
||||
# to the first arg_name encountered.
|
||||
MACRO(PARSE_ARGUMENTS prefix arg_names option_names)
|
||||
SET(DEFAULT_ARGS)
|
||||
FOREACH(arg_name ${arg_names})
|
||||
SET(${prefix}_${arg_name})
|
||||
ENDFOREACH(arg_name)
|
||||
FOREACH(option ${option_names})
|
||||
SET(${prefix}_${option} FALSE)
|
||||
ENDFOREACH(option)
|
||||
|
||||
SET(current_arg_name DEFAULT_ARGS)
|
||||
SET(current_arg_list)
|
||||
FOREACH(arg ${ARGN})
|
||||
LIST_CONTAINS(is_arg_name ${arg} ${arg_names})
|
||||
IF (is_arg_name)
|
||||
SET(${prefix}_${current_arg_name} ${current_arg_list})
|
||||
SET(current_arg_name ${arg})
|
||||
SET(current_arg_list)
|
||||
ELSE (is_arg_name)
|
||||
LIST_CONTAINS(is_option ${arg} ${option_names})
|
||||
IF (is_option)
|
||||
SET(${prefix}_${arg} TRUE)
|
||||
ELSE (is_option)
|
||||
SET(current_arg_list ${current_arg_list} ${arg})
|
||||
ENDIF (is_option)
|
||||
ENDIF (is_arg_name)
|
||||
ENDFOREACH(arg)
|
||||
SET(${prefix}_${current_arg_name} ${current_arg_list})
|
||||
ENDMACRO(PARSE_ARGUMENTS)
|
||||
|
||||
# Perform a reverse topological sort on the given LIST.
|
||||
#
|
||||
# topological_sort(my_list "MY_" "_EDGES")
|
||||
#
|
||||
# LIST is the name of a variable containing a list of elements to be
|
||||
# sorted in reverse topological order. Each element in the list has a
|
||||
# set of outgoing edges (for example, those other list elements that
|
||||
# it depends on). In the resulting reverse topological ordering
|
||||
# (written back into the variable named LIST), an element will come
|
||||
# later in the list than any of the elements that can be reached by
|
||||
# following its outgoing edges and the outgoing edges of any vertices
|
||||
# they target, recursively. Thus, if the edges represent dependencies
|
||||
# on build targets, for example, the reverse topological ordering is
|
||||
# the order in which one would build those targets.
|
||||
#
|
||||
# For each element E in this list, the edges for E are contained in
|
||||
# the variable named ${PREFIX}${E}${SUFFIX}, where E is the
|
||||
# upper-cased version of the element in the list. If no such variable
|
||||
# exists, then it is assumed that there are no edges. For example, if
|
||||
# my_list contains a, b, and c, one could provide a dependency graph
|
||||
# using the following variables:
|
||||
#
|
||||
# MY_A_EDGES b
|
||||
# MY_B_EDGES
|
||||
# MY_C_EDGES a b
|
||||
#
|
||||
# With the involcation of topological_sort shown above and these
|
||||
# variables, the resulting reverse topological ordering will be b, a,
|
||||
# c.
|
||||
function(topological_sort LIST PREFIX SUFFIX)
|
||||
# Clear the stack and output variable
|
||||
set(VERTICES "${${LIST}}")
|
||||
set(STACK)
|
||||
set(${LIST})
|
||||
|
||||
# Loop over all of the vertices, starting the topological sort from
|
||||
# each one.
|
||||
foreach(VERTEX ${VERTICES})
|
||||
string(TOUPPER ${VERTEX} UPPER_VERTEX)
|
||||
|
||||
# If we haven't already processed this vertex, start a depth-first
|
||||
# search from where.
|
||||
if (NOT FOUND_${UPPER_VERTEX})
|
||||
# Push this vertex onto the stack with all of its outgoing edges
|
||||
string(REPLACE ";" " " NEW_ELEMENT
|
||||
"${VERTEX};${${PREFIX}${UPPER_VERTEX}${SUFFIX}}")
|
||||
list(APPEND STACK ${NEW_ELEMENT})
|
||||
|
||||
# We've now seen this vertex
|
||||
set(FOUND_${UPPER_VERTEX} TRUE)
|
||||
|
||||
# While the depth-first search stack is not empty
|
||||
list(LENGTH STACK STACK_LENGTH)
|
||||
while(STACK_LENGTH GREATER 0)
|
||||
# Remove the vertex and its remaining out-edges from the top
|
||||
# of the stack
|
||||
list(GET STACK -1 OUT_EDGES)
|
||||
list(REMOVE_AT STACK -1)
|
||||
|
||||
# Get the source vertex and the list of out-edges
|
||||
separate_arguments(OUT_EDGES)
|
||||
list(GET OUT_EDGES 0 SOURCE)
|
||||
list(REMOVE_AT OUT_EDGES 0)
|
||||
|
||||
# While there are still out-edges remaining
|
||||
list(LENGTH OUT_EDGES OUT_DEGREE)
|
||||
while (OUT_DEGREE GREATER 0)
|
||||
# Pull off the first outgoing edge
|
||||
list(GET OUT_EDGES 0 TARGET)
|
||||
list(REMOVE_AT OUT_EDGES 0)
|
||||
|
||||
string(TOUPPER ${TARGET} UPPER_TARGET)
|
||||
if (NOT FOUND_${UPPER_TARGET})
|
||||
# We have not seen the target before, so we will traverse
|
||||
# its outgoing edges before coming back to our
|
||||
# source. This is the key to the depth-first traversal.
|
||||
|
||||
# We've now seen this vertex
|
||||
set(FOUND_${UPPER_TARGET} TRUE)
|
||||
|
||||
# Push the remaining edges for the current vertex onto the
|
||||
# stack
|
||||
string(REPLACE ";" " " NEW_ELEMENT
|
||||
"${SOURCE};${OUT_EDGES}")
|
||||
list(APPEND STACK ${NEW_ELEMENT})
|
||||
|
||||
# Setup the new source and outgoing edges
|
||||
set(SOURCE ${TARGET})
|
||||
string(TOUPPER ${SOURCE} UPPER_SOURCE)
|
||||
set(OUT_EDGES
|
||||
${${PREFIX}${UPPER_SOURCE}${SUFFIX}})
|
||||
endif(NOT FOUND_${UPPER_TARGET})
|
||||
|
||||
list(LENGTH OUT_EDGES OUT_DEGREE)
|
||||
endwhile (OUT_DEGREE GREATER 0)
|
||||
|
||||
# We have finished all of the outgoing edges for
|
||||
# SOURCE; add it to the resulting list.
|
||||
list(APPEND ${LIST} ${SOURCE})
|
||||
|
||||
# Check the length of the stack
|
||||
list(LENGTH STACK STACK_LENGTH)
|
||||
endwhile(STACK_LENGTH GREATER 0)
|
||||
endif (NOT FOUND_${UPPER_VERTEX})
|
||||
endforeach(VERTEX)
|
||||
|
||||
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()
|
||||
@@ -1,12 +0,0 @@
|
||||
#
|
||||
# Copyright Troy D. Straszheim
|
||||
#
|
||||
# Distributed under the Boost Software License, Version 1.0.
|
||||
# See http://www.boost.org/LICENSE_1_0.txt
|
||||
#
|
||||
cmake_minimum_required(VERSION 2.6)
|
||||
project(CompileTest)
|
||||
add_library(compile-test STATIC ${SOURCE})
|
||||
include_directories(${INCLUDES})
|
||||
set_source_files_properties(${SOURCE}
|
||||
PROPERTIES COMPILE_FLAGS "${COMPILE_FLAGS}")
|
||||
@@ -1,51 +0,0 @@
|
||||
# Finds the International Components for Unicode (ICU) Library
|
||||
#
|
||||
# ICU_FOUND - True if ICU found.
|
||||
# ICU_I18N_FOUND - True if ICU's internationalization library found.
|
||||
# ICU_INCLUDE_DIRS - Directory to include to get ICU headers
|
||||
# Note: always include ICU headers as, e.g.,
|
||||
# unicode/utypes.h
|
||||
# ICU_LIBRARIES - Libraries to link against for the common ICU
|
||||
# ICU_I18N_LIBRARIES - Libraries to link against for ICU internationaliation
|
||||
# (note: in addition to ICU_LIBRARIES)
|
||||
|
||||
# Look for the header file.
|
||||
find_path(
|
||||
ICU_INCLUDE_DIR
|
||||
NAMES unicode/utypes.h
|
||||
DOC "Include directory for the ICU library")
|
||||
mark_as_advanced(ICU_INCLUDE_DIR)
|
||||
|
||||
# Look for the library.
|
||||
find_library(
|
||||
ICU_LIBRARY
|
||||
NAMES icuuc cygicuuc cygicuuc32
|
||||
DOC "Libraries to link against for the common parts of ICU")
|
||||
mark_as_advanced(ICU_LIBRARY)
|
||||
|
||||
# Copy the results to the output variables.
|
||||
if(ICU_INCLUDE_DIR AND ICU_LIBRARY)
|
||||
set(ICU_FOUND 1)
|
||||
set(ICU_LIBRARIES ${ICU_LIBRARY})
|
||||
set(ICU_INCLUDE_DIRS ${ICU_INCLUDE_DIR})
|
||||
|
||||
# Look for the ICU internationalization libraries
|
||||
find_library(
|
||||
ICU_I18N_LIBRARY
|
||||
NAMES icuin icui18n cygicuin cygicuin32
|
||||
DOC "Libraries to link against for ICU internationalization")
|
||||
mark_as_advanced(ICU_I18N_LIBRARY)
|
||||
if (ICU_I18N_LIBRARY)
|
||||
set(ICU_I18N_FOUND 1)
|
||||
set(ICU_I18N_LIBRARIES ${ICU_I18N_LIBRARY})
|
||||
else (ICU_I18N_LIBRARY)
|
||||
set(ICU_I18N_FOUND 0)
|
||||
set(ICU_I18N_LIBRARIES)
|
||||
endif (ICU_I18N_LIBRARY)
|
||||
else(ICU_INCLUDE_DIR AND ICU_LIBRARY)
|
||||
set(ICU_FOUND 0)
|
||||
set(ICU_I18N_FOUND 0)
|
||||
set(ICU_LIBRARIES)
|
||||
set(ICU_I18N_LIBRARIES)
|
||||
set(ICU_INCLUDE_DIRS)
|
||||
endif(ICU_INCLUDE_DIR AND ICU_LIBRARY)
|
||||
@@ -1,26 +0,0 @@
|
||||
#
|
||||
# Copyright Troy D. Straszheim
|
||||
#
|
||||
# Distributed under the Boost Software License, Version 1.0.
|
||||
# See http://www.boost.org/LICENSE_1_0.txt
|
||||
#
|
||||
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})
|
||||
set_source_files_properties(${SOURCE}
|
||||
PROPERTIES COMPILE_FLAGS "${COMPILE_FLAGS}")
|
||||
|
||||
message("DEPENDS=====${DEPENDS}")
|
||||
|
||||
target_link_libraries(link-test
|
||||
${LINK_LIBS}
|
||||
${DEPENDS})
|
||||
@@ -1,9 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE catalog
|
||||
PUBLIC "-//OASIS/DTD Entity Resolution XML Catalog V1.0//EN"
|
||||
"http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd">
|
||||
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
|
||||
<rewriteURI uriStartString="http://www.boost.org/tools/boostbook/dtd/" rewritePrefix="file://@BOOSTBOOK_DTD_DIR@/"/>
|
||||
<rewriteURI uriStartString="http://docbook.sourceforge.net/release/xsl/current/" rewritePrefix="file://@DOCBOOK_XSL_DIR@/"/>
|
||||
<rewriteURI uriStartString="http://www.oasis-open.org/docbook/xml/4.2/" rewritePrefix="file://@DOCBOOK_DTD_DIR@/"/>
|
||||
</catalog>
|
||||
Reference in New Issue
Block a user