Boost logo

Boost-Commit :

From: dgregor_at_[hidden]
Date: 2007-06-08 14:33:20


Author: dgregor
Date: 2007-06-08 14:33:19 EDT (Fri, 08 Jun 2007)
New Revision: 4500
URL: http://svn.boost.org/trac/boost/changeset/4500

Log:
Document all of the CMake macros we define for Boost usage

Text files modified:
   sandbox-branches/boost-cmake/boost_1_34_0/CMakeLists.txt | 90 ++++++++---
   sandbox-branches/boost-cmake/boost_1_34_0/libs/CMakeLists.txt | 2
   sandbox-branches/boost-cmake/boost_1_34_0/libs/python/CMakeLists.txt | 5
   sandbox-branches/boost-cmake/boost_1_34_0/tools/build/CMake/boost-core.cmake | 310 ++++++++++++++++++++++++++++++---------
   sandbox-branches/boost-cmake/boost_1_34_0/tools/build/CMake/boost-testing.cmake | 216 +++++++++++++++++++++++++--
   5 files changed, 506 insertions(+), 117 deletions(-)

Modified: sandbox-branches/boost-cmake/boost_1_34_0/CMakeLists.txt
==============================================================================
--- sandbox-branches/boost-cmake/boost_1_34_0/CMakeLists.txt (original)
+++ sandbox-branches/boost-cmake/boost_1_34_0/CMakeLists.txt 2007-06-08 14:33:19 EDT (Fri, 08 Jun 2007)
@@ -1,18 +1,54 @@
+##########################################################################
+# CMake Build Rules for Boost #
+##########################################################################
+# Copyright (C) 2007 Douglas Gregor <doug.gregor_at_[hidden]> #
+# Copyright (C) 2007 Troy Straszheim #
+# #
+# Distributed under the Boost Software License, Version 1.0. #
+# See accompanying file LICENSE_1_0.txt or copy at #
+# http://www.boost.org/LICENSE_1_0.txt #
+##########################################################################
+# Basic Usage: #
+# #
+# On Unix variants: #
+# ccmake BOOST_DIRECTORY #
+# #
+# (c)onfigure options to your liking, then (g)enerate #
+# makefiles. Use "make" to build, "make test" to test, "make #
+# install" to install, and "make package" to build binary #
+# packages. #
+# #
+# On Windows: #
+# run the CMake GNU, load the Boost directory, and generate #
+# project files or makefiles for your environment. #
+# #
+# For more information about CMake, see http://www.cmake.org #
+##########################################################################
 cmake_minimum_required(VERSION 2.4.4 FATAL_ERROR)
-
 project(Boost)
 
 ##########################################################################
-# Global configurartion #
+# Version information #
 ##########################################################################
-
-# Boost version
 set(BOOST_VERSION_MAJOR 1)
 set(BOOST_VERSION_MINOR 34)
 set(BOOST_VERSION_SUBMINOR 0)
 set(BOOST_VERSION "${BOOST_VERSION_MAJOR}.${BOOST_VERSION_MINOR}.${BOOST_VERSION_SUBMINOR}")
+##########################################################################
 
-# Which library variants will we build?
+##########################################################################
+# Boost CMake modules #
+##########################################################################
+list(APPEND CMAKE_MODULE_PATH ${Boost_SOURCE_DIR}/tools/build/CMake)
+include(boost)
+include(BoostConfig)
+##########################################################################
+
+##########################################################################
+# Build Features and Variants #
+##########################################################################
+
+# User-level options deciding which variants we will build.
 option(BUILD_STATIC "Whether to build static libraries" ON)
 option(BUILD_SHARED "Whether to build shared libraries" ON)
 option(BUILD_DEBUG "Whether to build debugging libraries" ON)
@@ -20,32 +56,15 @@
 option(BUILD_SINGLE_THREADED "Whether to build single-threaded libraries" ON)
 option(BUILD_MULTI_THREADED "Whether to build multi-threaded libraries" ON)
 
-# Always include the Boost source directory, so that we can find
-# include files in boost/
-include_directories(${Boost_SOURCE_DIR})
-
-# Boost.Build version 2 does this due to trouble with autolinking
-# during building and testing. TODO: Try to remove this
-add_definitions(-DBOOST_ALL_NO_LIB=1)
-
-##########################################################################
-
-# Make it easy to find Boost-specific CMake modules
-list(APPEND CMAKE_MODULE_PATH ${Boost_SOURCE_DIR}/tools/build/CMake)
-
-include(boost)
-include(BoostConfig)
-
 # The default set of library variants that we will be building
 boost_add_default_variant(STATIC SHARED)
 boost_add_default_variant(DEBUG RELEASE)
 boost_add_default_variant(SINGLE_THREADED MULTI_THREADED)
+##########################################################################
 
 ##########################################################################
-# Boost installation #
+# Installation #
 ##########################################################################
-
-# Installation of Boost headers
 install(DIRECTORY boost
         DESTINATION include
         PATTERN "CVS" EXCLUDE
@@ -55,7 +74,6 @@
 ##########################################################################
 # Binary packages #
 ##########################################################################
-
 set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Boost")
 set(CPACK_PACKAGE_VENDOR "Boost.org")
 set(CPACK_PACKAGE_DESCRIPTION_FILE "${Boost_SOURCE_DIR}/README")
@@ -82,4 +100,26 @@
 include(CPack)
 ##########################################################################
 
+
+##########################################################################
+# Building Boost libraries #
+##########################################################################
+# Always include the Boost source directory, so that we can find
+# include files in boost/
+include_directories(${Boost_SOURCE_DIR})
+
+# Put the libaroes and binaroes that get built into directories at the
+# top of the build tree rather than in hard-to-find leaf
+# directories. This simplifies manual testing and the use of the build
+# tree rather than installed Boost libraries.
+SET(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib)
+SET(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin)
+
+# Boost.Build version 2 does this due to trouble with autolinking
+# during building and testing.
+# TODO: See if we can actually use auto-linking in our regression tests.
+add_definitions(-DBOOST_ALL_NO_LIB=1)
+
+# Add build rules for all of the Boost libraries
 add_subdirectory(libs)
+##########################################################################

Modified: sandbox-branches/boost-cmake/boost_1_34_0/libs/CMakeLists.txt
==============================================================================
--- sandbox-branches/boost-cmake/boost_1_34_0/libs/CMakeLists.txt (original)
+++ sandbox-branches/boost-cmake/boost_1_34_0/libs/CMakeLists.txt 2007-06-08 14:33:19 EDT (Fri, 08 Jun 2007)
@@ -9,7 +9,7 @@
   MESSAGE(STATUS "Scanning subdirectories:")
   foreach(BOOST_LIB_CMAKE_FILE ${BOOST_LIBRARY_CMAKE_FILES})
     get_filename_component(BOOST_LIB_DIR ${BOOST_LIB_CMAKE_FILE} PATH)
- append(${varname} ${BOOST_LIB_DIR})
+ set(${varname} ${${varname}} ${BOOST_LIB_DIR})
   endforeach(BOOST_LIB_CMAKE_FILE ${BOOST_LIBRARY_CMAKE_FILES})
 endmacro(BOOST_COLLECT_SUBPROJECT_DIRECTORY_NAMES varname)
 

Modified: sandbox-branches/boost-cmake/boost_1_34_0/libs/python/CMakeLists.txt
==============================================================================
--- sandbox-branches/boost-cmake/boost_1_34_0/libs/python/CMakeLists.txt (original)
+++ sandbox-branches/boost-cmake/boost_1_34_0/libs/python/CMakeLists.txt 2007-06-08 14:33:19 EDT (Fri, 08 Jun 2007)
@@ -11,6 +11,11 @@
     if(CMAKE_COMPILER_IS_GNUCXX)
       set(PYTHON_LIBRARIES ${PYTHON_LIBRARIES} "rt")
     endif(CMAKE_COMPILER_IS_GNUCXX)
+ elseif(CMAKE_SYSTEM_NAME MATCHES ".*BSD")
+ set(PYTHON_LIBRARIES ${PYTHON_LIBRARIES} "pthread")
+ elseif(CMAKE_SYSTEM_NAME STREQUAL "DragonFly")
+ # DragonFly is a variant of FreeBSD
+ set(PYTHON_LIBRARIES ${PYTHON_LIBRARIES} "pthread")
   elseif(CMAKE_SYSTEM_NAME STREQUAL "OSF")
     set(PYTHON_LIBRARIES ${PYTHON_LIBRARIES} "pthread" "dl")
     if(CMAKE_COMPILER_IS_GNUCXX)

Modified: sandbox-branches/boost-cmake/boost_1_34_0/tools/build/CMake/boost-core.cmake
==============================================================================
--- sandbox-branches/boost-cmake/boost_1_34_0/tools/build/CMake/boost-core.cmake (original)
+++ sandbox-branches/boost-cmake/boost_1_34_0/tools/build/CMake/boost-core.cmake 2007-06-08 14:33:19 EDT (Fri, 08 Jun 2007)
@@ -1,44 +1,65 @@
 ##########################################################################
-# Boost core support #
+# Core Functionality for Boost #
+##########################################################################
+# Copyright (C) 2007 Douglas Gregor <doug.gregor_at_[hidden]> #
+# 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 #
+##########################################################################
+# Important developer macros in this file: #
+# #
+# boost_library_project: Defines a Boost library project (e.g., #
+# Boost.Python). #
+# #
+# boost_library: Builds library binaries for Boost libraries with #
+# compiled sources (e.g., boost_filesystem). #
 ##########################################################################
-
-# Put the libs and bins that get built into directories at the top of
-# the build tree rather than in hard to find leaf directories
-SET(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib)
-SET(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin)
-
-# append to a variable
-macro(append varname)
- set(${varname} ${${varname}} ${ARGN})
-endmacro(append varname)
 
 # Defines a Boost library project (e.g., for Boost.Python). Use as:
 #
-# boost_library_project(libname, subdir1, subdir2, ...)
+# boost_library_project(libname
+# [SRCDIRS srcdir1 srcdir2 ...]
+# [TESTDIRS testdir1 testdir2 ...])
 #
 # where libname is the name of the library (e.g., Python, or
-# Filesystem) and subdir1, subdir2, etc. are the subdirectories that
-# contain CMakeLists files.
-#
-# This macro will define an option BUILD_BOOST_LIBNAME (which defaults
-# to ON). When the option is true, this macro will include the
-# subdirectories; otherwise, none of the subdirectories will be
-# included, so the library itself will not be built, installed, or
-# tested.
-macro(boost_library_project libname_)
+# Filesystem), srcdir1, srcdir2, etc, are subdirectories containing
+# library sources (for Boost libraries that build actual library
+# binaries), and testdir1, testdir2, etc, are subdirectories
+# containing regression tests.
+#
+# For libraries that build actual library binaries, this macro adds a
+# option BUILD_BOOST_LIBNAME (which defaults to ON). When the option
+# is ON, this macro will include the source subdirectories, and
+# 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
+# defines the TEST_BOOST_LIBNAME option (defaults to ON). When ON, the
+# generated makefiles/project files will contain regression tests for
+# this library.
+#
+# Example:
+# boost_library_project(
+# Thread
+# SRCDIRS src
+# TESTDIRS test
+# )
+macro(boost_library_project LIBNAME)
   parse_arguments(THIS_PROJECT
     "SRCDIRS;TESTDIRS"
     ""
     ${ARGN}
     )
 
- string(TOUPPER "BUILD_BOOST_${libname_}" BOOST_BUILD_LIB_OPTION)
+ string(TOUPPER "BUILD_BOOST_${LIBNAME}" BOOST_BUILD_LIB_OPTION)
   if (THIS_PROJECT_SRCDIRS)
     # This Boost library has source directories, so provide an option
     # BUILD_BOOST_LIBNAME that allows one to turn on/off building of
     # the library.
     option(${BOOST_BUILD_LIB_OPTION}
- "Build Boost.${libname_} (prefer make targets, not this, to build individual libs)"
+ "Build Boost.${LIBNAME} (prefer make targets, not this, to build individual libs)"
       ON)
   else (THIS_PROJECT_SRCDIRS)
     # This Boost library has no source directories, and therefore does
@@ -48,7 +69,7 @@
   endif (THIS_PROJECT_SRCDIRS)
 
   if(${BOOST_BUILD_LIB_OPTION})
- string(TOLOWER "${libname_}" libname)
+ string(TOLOWER "${LIBNAME}" libname)
     project(${libname})
 
     if(NOT EXISTS ${CMAKE_BINARY_DIR}/bin/${PROJECT_NAME})
@@ -63,9 +84,9 @@
     if(BUILD_TESTING AND THIS_PROJECT_TESTDIRS)
       # Testing is enabled globally and this project has some
       # tests. So, add a testing option.
- string(TOUPPER "TEST_BOOST_${libname_}" BOOST_TEST_LIB_OPTION)
+ string(TOUPPER "TEST_BOOST_${LIBNAME}" BOOST_TEST_LIB_OPTION)
       option(${BOOST_TEST_LIB_OPTION}
- "Enable testing of Boost.${libname_}"
+ "Enable testing of Boost.${LIBNAME}"
         ON)
 
       # Only include the test directories when testing is enabled for
@@ -79,35 +100,52 @@
   endif(${BOOST_BUILD_LIB_OPTION})
 endmacro(boost_library_project)
 
+# This macro is an internal utility macro that builds the name of a
+# particular variant of a library
+#
+# boost_library_variant_target_name(feature1 feature2 ...)
+#
+# where feature1, feature2, etc. are the names of features to be
+# included in this variant, e.g., MULTI_THREADED, DEBUG.
+#
+# This macro sets two macros:
+#
+# VARIANT_TARGET_NAME: The suffix that should be appended to the
+# name of the library target to name this variant of the
+# library. For example, this might be "-mt-static" for a static,
+# multi-threaded variant. It should be used to name the CMake
+# library target, e.g., boost_signals-mt-static.
+#
+# VARIANT_VERSIONED_NAME: The suffix that will be added to the name
+# of the generated library, containing information about the
+# particular version of the library and the toolset used to build
+# this library. For example, this might be "-gcc41-mt-1_34" for the
+# multi-threaded, release variant of the library in Boost 1.34.0 as
+# compiled with GCC 4.1.
 macro(boost_library_variant_target_name)
   set(VARIANT_TARGET_NAME "")
- set(VARIANT_VERSIONED_NAME "")
-
- if (BUILD_VERSIONED)
- # If we're using versioning for the names of our generated
- # libraries, detect the full toolset name.
- set(VARIANT_VERSIONED_NAME "-${BOOST_TOOLSET}")
- endif (BUILD_VERSIONED)
 
   # Add -mt for multi-threaded libraries
- list_contains(variant_is_mt MULTI_THREADED ${ARGN})
- if (variant_is_mt)
+ list_contains(VARIANT_IS_MT MULTI_THREADED ${ARGN})
+ if (VARIANT_IS_MT)
     set(VARIANT_TARGET_NAME "${VARIANT_TARGET_NAME}-mt")
 
- if (BUILD_VERSIONED)
- # If we're creating versioned names, tack on "-mt"
- set(VARIANT_VERSIONED_NAME "${VARIANT_VERSIONED_NAME}-mt")
- endif (BUILD_VERSIONED)
- endif (variant_is_mt)
+ # If we're creating versioned names, tack on "-mt"
+ set(VARIANT_VERSIONED_NAME "${VARIANT_VERSIONED_NAME}-mt")
+ endif (VARIANT_IS_MT)
 
   # Add -static for static libraries, -shared for shared libraries
- list_contains(variant_is_static STATIC ${ARGN})
- if (variant_is_static)
+ list_contains(VARIANT_IS_STATIC STATIC ${ARGN})
+ if (VARIANT_IS_STATIC)
     set(VARIANT_TARGET_NAME "${VARIANT_TARGET_NAME}-static")
- else (variant_is_static)
+ else (VARIANT_IS_STATIC)
     set(VARIANT_TARGET_NAME "${VARIANT_TARGET_NAME}-shared")
- endif (variant_is_static)
+ endif (VARIANT_IS_STATIC)
+
+ # The versioned name starts with the full Boost toolset
+ set(VARIANT_VERSIONED_NAME "-${BOOST_TOOLSET}")
 
+ # Compute the ABI tag, which depends on various kinds of options
   set(VARIANT_ABI_TAG "")
 
   # TODO: Linking statically to the runtime library
@@ -117,32 +155,48 @@
   # TODO: STLport's deprecated iostreams
 
   # Add -debug for debug libraries
- list_contains(variant_is_debug DEBUG ${ARGN})
- if (variant_is_debug)
+ list_contains(VARIANT_IS_DEBUG DEBUG ${ARGN})
+ if (VARIANT_IS_DEBUG)
     set(VARIANT_TARGET_NAME "${VARIANT_TARGET_NAME}-debug")
+ set(VARIANT_ABI_TAG "${VARIANT_ABI_TAG}d")
+ endif (VARIANT_IS_DEBUG)
 
- if (BUILD_VERSIONED)
- set(VARIANT_ABI_TAG "${VARIANT_ABI_TAG}d")
- endif (BUILD_VERSIONED)
- endif (variant_is_debug)
-
- if (BUILD_VERSIONED)
- # If there is an ABI tag, append it to the versioned name
- if (VARIANT_ABI_TAG)
- set(VARIANT_VERSIONED_NAME "${VARIANT_VERSIONED_NAME}-${VARIANT_ABI_TAG}")
- endif (VARIANT_ABI_TAG)
-
- # Append the Boost version number to the versioned name
- if(BOOST_VERSION_SUBMINOR GREATER 0)
- set(VARIANT_VERSIONED_NAME
- "${VARIANT_VERSIONED_NAME}-${BOOST_VERSION_MAJOR}_${BOOST_VERSION_MINOR}_${BOOST_VERSION_SUBMINOR}")
- else(BOOST_VERSION_SUBMINOR GREATER 0)
- set(VARIANT_VERSIONED_NAME
- "${VARIANT_VERSIONED_NAME}-${BOOST_VERSION_MAJOR}_${BOOST_VERSION_MINOR}")
- endif(BOOST_VERSION_SUBMINOR GREATER 0)
- endif (BUILD_VERSIONED)
+ # If there is an ABI tag, append it to the versioned name
+ if (VARIANT_ABI_TAG)
+ set(VARIANT_VERSIONED_NAME "${VARIANT_VERSIONED_NAME}-${VARIANT_ABI_TAG}")
+ endif (VARIANT_ABI_TAG)
+
+ # Append the Boost version number to the versioned name
+ if(BOOST_VERSION_SUBMINOR GREATER 0)
+ set(VARIANT_VERSIONED_NAME
+ "${VARIANT_VERSIONED_NAME}-${BOOST_VERSION_MAJOR}_${BOOST_VERSION_MINOR}_${BOOST_VERSION_SUBMINOR}")
+ else(BOOST_VERSION_SUBMINOR GREATER 0)
+ set(VARIANT_VERSIONED_NAME
+ "${VARIANT_VERSIONED_NAME}-${BOOST_VERSION_MAJOR}_${BOOST_VERSION_MINOR}")
+ endif(BOOST_VERSION_SUBMINOR GREATER 0)
 endmacro(boost_library_variant_target_name)
 
+# This macro is an internal utility macro that builds a particular
+# variant of a boost library.
+#
+# boost_library_variant(libname
+# feature1 feature2 ...)
+#
+# where libname is the name of the Boost library (e.g.,
+# "boost_filesystem") and feature1, feature2, ... are the features
+# that will be used in this variant.
+#
+# This macro will define a new library target based on libname and the
+# specific variant name (see boost_library_variant_target_name), which
+# depends on the utility target libname. The compilation and linking
+# flags for this library are defined by THIS_LIB_COMPILE_FLAGS,
+# THIS_LIB_LINK_FLAGS, THIS_LIB_LINK_LIBS, and all of the compile and
+# linking flags implied by the features provided.
+#
+# 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
+# MULTI_THREADED, this macro will essentially be a no-op.
 macro(boost_library_variant LIBNAME)
   set(THIS_VARIANT_COMPILE_FLAGS "${THIS_LIB_COMPILE_FLAGS}")
   set(THIS_VARIANT_LINK_FLAGS "${THIS_LIB_LINK_FLAGS}")
@@ -332,14 +386,129 @@
   endforeach(FEATURE ${ARGN})
 endmacro(boost_add_default_variant)
 
-macro(boost_library)
+# Creates a new Boost library target that generates a compiled library
+# (.a, .lib, .dll, .so, etc) from source files. This routine will
+# actually build several different variants of the same library, with
+# different compilation options, as determined by the set of "default"
+# library variants.
+#
+# boost_library(libname
+# source1 source2 ...
+# [COMPILE_FLAGS compileflags]
+# [feature_COMPILE_FLAGS compileflags]
+# [LINK_FLAGS linkflags]
+# [feature_LINK_FLAGS linkflags]
+# [LINK_LIBS linklibs]
+# [feature_LINK_LIBS linklibs]
+# [DEPENDS libdepend1 libdepend2 ...]
+# [STATIC_TAG]
+# [MODULE]
+# [NOT_feature])
+#
+# where libname is the name of Boost library binary (e.g.,
+# "boost_regex") and source1, source2, etc. are the source files used
+# to build the library, e.g., cregex.cpp.
+#
+# This macro has a variety of options that affect its behavior. In
+# several cases, we use the placeholder "feature" in the option name
+# to indicate that there are actually several different kinds of
+# options, each referring to a different build feature, e.g., shared
+# libraries, multi-threaded, debug build, etc. For a complete listing
+# of these features, please refer to the CMakeLists.txt file in the
+# root of the Boost distribution, which defines the set of features
+# that will be used to build Boost libraries by default.
+#
+# The options that affect this macro's behavior are:
+#
+# COMPILE_FLAGS: Provides additional compilation flags that will be
+# used when building all variants of the library. For example, one
+# might want to add "-DBOOST_SIGNALS_NO_LIB=1" through this option
+# (which turns off auto-linking for the Signals library while
+# building it).
+#
+# feature_COMPILE_FLAGS: Provides additional compilation flags that
+# will be used only when building variants of the library that
+# include the given feature. For example,
+# MULTI_THREADED_COMPILE_FLAGS are additional flags that will be
+# used when building a multi-threaded variant, while
+# SHARED_COMPILE_FLAGS will be used when building a shared library
+# (as opposed to a static library).
+#
+# LINK_FLAGS: Provides additional flags that will be passed to the
+# linker when linking each variant of the library. This option
+# should not be used to link in additional libraries; see LINK_LIBS
+# and DEPENDS.
+#
+# feature_LINK_FLAGS: Provides additional flags that will be passed
+# to the linker when building variants of the library that contain a
+# specific feature, e.g., MULTI_THREADED_LINK_FLAGS. This option
+# should not be used to link in additional libraries; see
+# feature_LINK_LIBS.
+#
+# LINK_LIBS: Provides additional libraries against which each of the
+# library variants will be linked. For example, one might provide
+# "expat" as options to LINK_LIBS, to state that each of the library
+# variants will link against the expat library binary. Use LINK_LIBS
+# for libraries external to Boost; for Boost libraries, use DEPENDS.
+#
+# feature_LINK_LIBS: Provides additional libraries for specific
+# variants of the library to link against. For example,
+# MULTI_THREADED_LINK_LIBS provides extra libraries to link into
+# multi-threaded variants of the library.
+#
+# DEPENDS: States that this Boost libraries depends on and links
+# against another Boost library. The arguments to DEPENDS should be
+# the unversioned name of the Boost library, such as
+# "boost_filesystem". Like LINK_LIBS, this option states that all
+# variants of the library being built will link against the stated
+# libraries. Unlike LINK_LIBS, however, DEPENDS takes particular
+# library variants into account, always linking the variant of one
+# Boost library against the same variant of the other Boost
+# library. For example, if the boost_mpi_python library DEPENDS on
+# 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
+# some platforms, such as Mac OS X.
+#
+# NOT_feature: States that library variants containing a particular
+# feature should not be built. For example, passing
+# NOT_SINGLE_THREADED suppresses generation of single-threaded
+# variants of this library.
+#
+#
+# Example:
+# boost_library(
+# boost_thread
+# barrier.cpp condition.cpp exceptions.cpp mutex.cpp once.cpp
+# recursive_mutex.cpp thread.cpp tss_hooks.cpp tss_dll.cpp tss_pe.cpp
+# tss.cpp xtime.cpp
+# SHARED_COMPILE_FLAGS "-DBOOST_THREAD_BUILD_DLL=1"
+# STATIC_COMPILE_FLAGS "-DBOOST_THREAD_BUILD_LIB=1"
+# NO_SINGLE_THREADED
+# )
+#
+# TODO:
+# - Rename this to boost_add_library.
+macro(boost_library LIBNAME)
   parse_arguments(THIS_LIB
- "DEPENDS;LINK_LIBS;COMPILE_FLAGS;LINK_FLAGS;${BOOST_ADDLIB_ARG_NAMES}"
+ "DEPENDS;COMPILE_FLAGS;LINK_FLAGS;LINK_LIBS;${BOOST_ADDLIB_ARG_NAMES}"
     "STATIC_TAG;MODULE;${BOOST_ADDLIB_OPTION_NAMES}"
     ${ARGN}
     )
- car(LIBNAME ${THIS_LIB_DEFAULT_ARGS})
- cdr(THIS_LIB_SOURCES ${THIS_LIB_DEFAULT_ARGS})
+ set(THIS_LIB_SOURCES ${THIS_LIB_DEFAULT_ARGS})
 
   # A top-level target that refers to all of the variants of the
   # library, collectively.
@@ -353,3 +522,4 @@
   endforeach(VARIANT_STR ${BOOST_DEFAULT_VARIANTS})
 endmacro(boost_library)
 
+# TODO: Create boost_add_executable, which deals with variants well
\ No newline at end of file

Modified: sandbox-branches/boost-cmake/boost_1_34_0/tools/build/CMake/boost-testing.cmake
==============================================================================
--- sandbox-branches/boost-cmake/boost_1_34_0/tools/build/CMake/boost-testing.cmake (original)
+++ sandbox-branches/boost-cmake/boost_1_34_0/tools/build/CMake/boost-testing.cmake 2007-06-08 14:33:19 EDT (Fri, 08 Jun 2007)
@@ -1,21 +1,21 @@
 ##########################################################################
-# Boost testing support #
+# Regression Testing Support for Boost #
 ##########################################################################
+# Copyright (C) 2007 Douglas Gregor <doug.gregor_at_[hidden]> #
+# 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 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.
 #
-# 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, all remaining arguments to the test
-# macro will be used as the source files.
-#
-# To link in additional libraries when building the executable, pass
-# LIBRARIES to the boost_*_test macro followed by followed by the list
-# of libraries to link, e.g.,
-#
-# boost_test_run(signal_n_test LIBRARIES boost_test_exec_monitor)
-#
-# There are several macros that create tests:
-#
+# 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.
 #
@@ -28,14 +28,44 @@
 #
 # boost_test_compile_fail: Tests that the given source file produces
 # errors when compiled.
-#
-#
-# These macros format the displayed name of the test as
-# PROJECT_NAME::testname, where PROJECT_NAME is a global set by the
-# CMake PROJECT macro inside boost_library_project.
+
+# 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_TESTING "Enable testing" OFF)
 include(CTest)
 
+# 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 ...])
+#
+# 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_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)
   set(BOOST_TEST_OKAY TRUE)
   set(BOOST_TEST_COMPILE_FLAGS "")
@@ -45,7 +75,8 @@
     ${ARGN}
     )
     
- # Categorize each of the arguments
+ # 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)
@@ -76,6 +107,59 @@
   endif(NOT BUILD_TESTING)
 endmacro(boost_test_parse_args)
 
+# 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 ...])
+#
+# 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.
+#
+# Example:
+# boost_test_run(signal_test DEPENDS boost_signals-static)
+#
+# TODO:
+# - Improve handling of DEPENDS, so that we can specify just the
+# library's abstract target (e.g., "boost_signals"), and possibly
+# some features required for building the test (e.g.,
+# MULTI_THREADED, STATIC). The test macros should then pick the
+# best library variant available to meet those features and the
+# current build variant (Debug or Release).
 macro(boost_test_run testname)
   boost_test_parse_args(${testname} ${ARGN})
   if (BOOST_TEST_OKAY)
@@ -92,6 +176,59 @@
   endif(BOOST_TEST_OKAY)
 endmacro(boost_test_run)
 
+# This macro creates a Boost regression test that will be executed. If
+# the test can be built, executed, and exits with a return code that
+# is not zero, it will be considered to have passed.
+#
+# boost_test_run_fail(testname
+# [source1 source2 ...]
+# [ARGS arg1 arg2... ]
+# [COMPILE_FLAGS compileflags]
+# [LINK_FLAGS linkflags]
+# [LINK_LIBS linklibs]
+# [DEPENDS libdepend1 libdepend2 ...])
+#
+# 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.
+#
+# Example:
+# boost_test_run_fail(prg_exec_fail1 DEPENDS boost_prg_exec_monitor-static)
+#
+# TODO:
+# - Improve handling of DEPENDS, so that we can specify just the
+# library's abstract target (e.g., "boost_signals"), and possibly
+# some features required for building the test (e.g.,
+# MULTI_THREADED, STATIC). The test macros should then pick the
+# best library variant available to meet those features and the
+# current build variant (Debug or Release).
 macro(boost_test_run_fail testname)
   boost_test_parse_args(${testname} ${ARGN})
   if(BOOST_TEST_OKAY)
@@ -99,6 +236,7 @@
     set_target_properties(${testname}
       PROPERTIES
       COMPILE_FLAGS "${BOOST_TEST_COMPILE_FLAGS}"
+ LINK_FLAGS "${BOOST_TEST_LINK_FLAGS}"
       OUTPUT_NAME ${PROJECT_NAME}/${testname})
     target_link_libraries(${testname} ${BOOST_TEST_DEPENDS})
     target_link_libraries(${testname} ${BOOST_TEST_LINK_LIBS})
@@ -109,6 +247,8 @@
   endif(BOOST_TEST_OKAY)
 endmacro(boost_test_run_fail)
 
+# Under construction...
+
 macro(boost_test_link testname)
   boost_test_parse_args(${testname} ${ARGN})
   if(BOOST_TEST_OKAY)
@@ -124,6 +264,23 @@
   endif(BOOST_TEST_OKAY)
 endmacro(boost_test_link)
 
+# 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})
 
@@ -148,6 +305,23 @@
   endif(BOOST_TEST_OKAY)
 endmacro(boost_test_compile)
 
+# This macro creates a Boost regression test that will be compiled,
+# but compilation should fail. It is used to test, e.g., that certain
+# disallowed syntax does in fact cause a compilation failure.
+#
+# boost_test_compile_fail(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_fail(function_test_fail1)
 macro(boost_test_compile_fail testname)
   boost_test_parse_args(${testname} ${ARGN})
 


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk