$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
From: dgregor_at_[hidden]
Date: 2008-04-20 19:41:40
Author: dgregor
Date: 2008-04-20 19:41:40 EDT (Sun, 20 Apr 2008)
New Revision: 44658
URL: http://svn.boost.org/trac/boost/changeset/44658
Log:
- Add support for exporting the right CPack variables to allow users to select specific components to install
- Fix an issue with missed library dependencies the first time around.
Text files modified: 
   branches/CMake/release/CMakeLists.txt                    |    77 ++++++++++++++++++++---------------     
   branches/CMake/release/libs/CMakeLists.txt               |    10 ++++                                    
   branches/CMake/release/tools/build/CMake/BoostCore.cmake |    84 ++++++++++++++++++++++++++++++++++++--- 
   3 files changed, 131 insertions(+), 40 deletions(-)
Modified: branches/CMake/release/CMakeLists.txt
==============================================================================
--- branches/CMake/release/CMakeLists.txt	(original)
+++ branches/CMake/release/CMakeLists.txt	2008-04-20 19:41:40 EDT (Sun, 20 Apr 2008)
@@ -96,13 +96,46 @@
 endif(BOOST_VERSION_SUBMINOR GREATER 0)
 install(DIRECTORY boost 
         DESTINATION ${BOOST_HEADER_DIR}
+        COMPONENT Core
         PATTERN "CVS" EXCLUDE
         REGEX ".svn" EXCLUDE)
 if (NOT TEST_INSTALLED_TREE)
   # If I don't have if around this, I get a seg fault
   install(EXPORT boost-targets DESTINATION "lib/Boost${BOOST_VERSION}")
 endif (NOT TEST_INSTALLED_TREE)
+##########################################################################
+
+
+##########################################################################
+# Building Boost libraries                                               #
+##########################################################################
+# Always include the directory where Boost's include files will be.
+if (TEST_INSTALLED_TREE)
+  # Use the headers from the installation directory
+  include_directories("${CMAKE_INSTALL_PREFIX}/${BOOST_HEADER_DIR}")
+else (TEST_INSTALLED_TREE)
+  # Use the headers directly from the Boost source tree (in boost/)
+  include_directories(${Boost_SOURCE_DIR})
+endif (TEST_INSTALLED_TREE)
+
+# Put the libaries and binaries that get built into directories at the
+# top of the build tree rather than in hard-to-find leaf
+# directories. This simplifies manual testing and the use of the build
+# tree rather than installed Boost libraries.
+SET(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)
+
+# Add build rules for all of the Boost tools
+# TODO: On hold while I work on the modularity code
+# add_subdirectory(tools)
 ##########################################################################
 
 ##########################################################################
@@ -120,6 +153,17 @@
 set(CPACK_PACKAGE_VERSION_MINOR "${BOOST_VERSION_MINOR}")
 set(CPACK_PACKAGE_VERSION_PATCH "${BOOST_VERSION_SUBMINOR}")
 set(CPACK_PACKAGE_INSTALL_DIRECTORY "Boost")
+
+# Setup "core" component
+if (CPACK_COMPONENTS_BOOST_ALL)
+  list(SORT CPACK_COMPONENTS_BOOST_ALL)
+endif ()
+set(CPACK_COMPONENTS_BOOST_ALL "Core" ${CPACK_COMPONENTS_BOOST_ALL})
+set(CPACK_COMPONENT_BOOST_CORE_REQUIRED ON)
+set(CPACK_COMPONENT_BOOST_CORE_DISPLAY_NAME "Core libraries")
+set(CPACK_COMPONENT_BOOST_CORE_DESCRIPTION 
+  "The headers and core library binaries required to use Boost")
+
 if(WIN32 AND NOT UNIX)
   # There is a bug in NSI that does not handle full unix paths properly. Make
   # sure there is at least one set of four (4) backlasshes.
@@ -149,36 +193,3 @@
 endif(WIN32 AND NOT UNIX)
 include(CPack)
 ##########################################################################
-
-
-##########################################################################
-# Building Boost libraries                                               #
-##########################################################################
-# Always include the directory where Boost's include files will be.
-if (TEST_INSTALLED_TREE)
-  # Use the headers from the installation directory
-  include_directories("${CMAKE_INSTALL_PREFIX}/${BOOST_HEADER_DIR}")
-else (TEST_INSTALLED_TREE)
-  # Use the headers directly from the Boost source tree (in boost/)
-  include_directories(${Boost_SOURCE_DIR})
-endif (TEST_INSTALLED_TREE)
-
-# Put the libaries and binaries that get built into directories at the
-# top of the build tree rather than in hard-to-find leaf
-# directories. This simplifies manual testing and the use of the build
-# tree rather than installed Boost libraries.
-SET(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)
-
-# Add build rules for all of the Boost tools
-# TODO: On hold while I work on the modularity code
-# add_subdirectory(tools)
-##########################################################################
Modified: branches/CMake/release/libs/CMakeLists.txt
==============================================================================
--- branches/CMake/release/libs/CMakeLists.txt	(original)
+++ branches/CMake/release/libs/CMakeLists.txt	2008-04-20 19:41:40 EDT (Sun, 20 Apr 2008)
@@ -32,6 +32,16 @@
 
 # Add all of the Boost projects in reverse topological order, so that
 # a library's dependencies show up before the library itself.
+set(CPACK_INSTALL_CMAKE_COMPONENTS_ALL)
 list(SORT BOOST_SUBPROJECT_DIRS)
 topological_sort(BOOST_SUBPROJECT_DIRS BOOST_ _DEPENDS)
 add_subdirectories(" + " ${BOOST_SUBPROJECT_DIRS})
+
+# Export the list of components to be installed
+set(CPACK_COMPONENTS_BOOST_ALL ${CPACK_COMPONENTS_BOOST_ALL} PARENT_SCOPE)
+set(CPACK_COMPONENT_GROUPS_BOOST_ALL ${CPACK_COMPONENT_GROUPS_BOOST_ALL} PARENT_SCOPE)
+
+# Export all of the variables that have been marked as "to be exported"
+foreach(MACRO ${BOOST_EXPORT_MACROS})
+  set(${MACRO} ${${MACRO}} PARENT_SCOPE)
+endforeach()
Modified: branches/CMake/release/tools/build/CMake/BoostCore.cmake
==============================================================================
--- branches/CMake/release/tools/build/CMake/BoostCore.cmake	(original)
+++ branches/CMake/release/tools/build/CMake/BoostCore.cmake	2008-04-20 19:41:40 EDT (Sun, 20 Apr 2008)
@@ -65,6 +65,9 @@
     ${ARGN}
     )
 
+  # The names of all of the macros that need to be exported to the outer scope.
+  set(THIS_PROJECT_EXPORT_MACROS)
+  
   set(THIS_PROJECT_OKAY ON)
   string(TOUPPER "BOOST_${LIBNAME}_DEPENDS" THIS_PROJECT_DEPENDS)
   set(THIS_PROJECT_FAILED_DEPS "")
@@ -104,15 +107,22 @@
 
   if(${BOOST_BUILD_LIB_OPTION} AND THIS_PROJECT_OKAY)
     string(TOLOWER "${LIBNAME}" libname)
-    project(${libname})
+    string(TOUPPER "${LIBNAME}" ULIBNAME)
+    project(${LIBNAME})
 
+    if(THIS_PROJECT_MODULAR OR THIS_PROJECT_SRCDIRS)
+      # Add this library to the list of library components to install
+      set(CPACK_COMPONENT_GROUPS_BOOST_ALL ${CPACK_COMPONENT_GROUPS_BOOST_ALL} ${ULIBNAME} PARENT_SCOPE)
+      set(CPACK_COMPONENT_GROUP_BOOST_${ULIBNAME}_DISPLAY_NAME ${LIBNAME})
+      list(APPEND THIS_PROJECT_EXPORT_MACROS CPACK_COMPONENT_GROUP_BOOST_${ULIBNAME}_DISPLAY_NAME)
+    endif(THIS_PROJECT_MODULAR OR THIS_PROJECT_SRCDIRS)
+    
     if(THIS_PROJECT_MODULAR)
       # If this is a modular project, set a variable
       # BOOST_${LIBNAME}_IS_MODULAR in the *parent* scope, so that
       # other libraries know that this is a modular library. Thus,
       # they will add the appropriate include paths.
-      string(TOUPPER "BOOST_${LIBNAME}_IS_MODULAR" THIS_PROJECT_IS_MODULAR)
-      set(${THIS_PROJECT_IS_MODULAR} TRUE CACHE INTERNAL "" FORCE)
+      set(BOOST_${ULIBNAME}_IS_MODULAR TRUE PARENT_SCOPE)
 
       # Add this module's include directory
       include_directories("${Boost_SOURCE_DIR}/libs/${libname}/include")
@@ -120,19 +130,35 @@
       # Install this module's headers
       install(DIRECTORY include/boost 
         DESTINATION ${BOOST_HEADER_DIR}
-        COMPONENT ${LIBNAME}
+        COMPONENT ${ULIBNAME}_headers
         PATTERN "CVS" EXCLUDE
         REGEX ".svn" EXCLUDE)
+              
+      # Add the appropriate variables to make this library's headers a separate component.
+      set(THIS_PROJECT_COMPONENTS ${THIS_PROJECT_COMPONENTS} ${ULIBNAME}_headers)
+      set(CPACK_COMPONENT_BOOST_${ULIBNAME}_HEADERS_DISPLAY_NAME "Header files")
+      set(CPACK_COMPONENT_BOOST_${ULIBNAME}_HEADERS_GROUP ${ULIBNAME})
+      list(APPEND THIS_PROJECT_EXPORT_MACROS 
+		CPACK_COMPONENT_BOOST_${ULIBNAME}_HEADERS_DISPLAY_NAME
+		CPACK_COMPONENT_BOOST_${ULIBNAME}_HEADERS_GROUP)
     endif (THIS_PROJECT_MODULAR)
 
     # For each of the modular libraries on which this project depends,
     # add the include path for that library.
     foreach(DEP ${${THIS_PROJECT_DEPENDS}})
+      string(TOUPPER ${DEP} UDEP)
       string(TOUPPER "BOOST_${DEP}_IS_MODULAR" BOOST_LIB_DEP_MODULAR)
-      if(${BOOST_LIB_DEP_MODULAR})
+      if(BOOST_${UDEP}_IS_MODULAR)
         include_directories("${Boost_SOURCE_DIR}/libs/${DEP}/include")
-      endif(${BOOST_LIB_DEP_MODULAR})
+        if (THIS_PROJECT_MODULAR)
+          # Make this project's headers depend on DEP's headers
+          list(APPEND CPACK_COMPONENT_BOOST_${ULIBNAME}_HEADERS_DEPENDS ${UDEP}_headers)
+        endif ()
+      endif()
     endforeach(DEP)
+    if (CPACK_COMPONENT_BOOST_${ULIBNAME}_HEADERS_DEPENDS)
+      list(APPEND THIS_PROJECT_EXPORT_MACROS CPACK_COMPONENT_BOOST_${ULIBNAME}_HEADERS_DEPENDS)
+    endif ()
 
     if(NOT EXISTS ${CMAKE_BINARY_DIR}/bin/tests)
       file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/bin/tests)
@@ -163,6 +189,15 @@
       endif(${BOOST_TEST_LIB_OPTION})
     endif(BUILD_TESTING AND THIS_PROJECT_TESTDIRS)
   endif(${BOOST_BUILD_LIB_OPTION} AND THIS_PROJECT_OKAY)
+  
+  # Export certain macros to the parent scope.
+  foreach(MACRO ${THIS_PROJECT_EXPORT_MACROS})
+    set(${MACRO} ${${MACRO}} PARENT_SCOPE)
+  endforeach()
+  set(BOOST_EXPORT_MACROS 
+	${BOOST_EXPORT_MACROS} ${THIS_PROJECT_EXPORT_MACROS} PARENT_SCOPE)
+  set(CPACK_COMPONENTS_BOOST_ALL 
+	${CPACK_COMPONENTS_BOOST_ALL} ${THIS_PROJECT_COMPONENTS} PARENT_SCOPE)
 endmacro(boost_library_project)
 
 macro(boost_module LIBNAME)
@@ -452,9 +487,44 @@
     endforeach(dependency "${THIS_LIB_DEPENDS}")
 
     # Installation of this library variant
+    string(TOUPPER ${PROJECT_NAME} ULIBNAME)
     install(TARGETS ${VARIANT_LIBNAME} DESTINATION lib
       EXPORT boost-targets
-      COMPONENT ${PROJECT_NAME})
+      COMPONENT ${ULIBNAME}_libraries)
+      
+    # Add the appropriate variables to make this library's binaries a separate component.
+    if (NOT THIS_PROJECT_ADDED_LIBRARIES_COMPONENT)
+      set(THIS_PROJECT_ADDED_LIBRARIES_COMPONENT ON)
+      set(THIS_PROJECT_COMPONENTS ${THIS_PROJECT_COMPONENTS} ${ULIBNAME}_libraries PARENT_SCOPE)
+      set(CPACK_COMPONENT_BOOST_${ULIBNAME}_LIBRARIES_DISPLAY_NAME "Library binaries" PARENT_SCOPE)
+      set(CPACK_COMPONENT_BOOST_${ULIBNAME}_LIBRARIES_GROUP ${ULIBNAME} PARENT_SCOPE)
+	  
+	  # Make the library installation component dependent on the library installation
+	  # components of dependent libraries.  
+	  foreach(DEP ${${THIS_PROJECT_DEPENDS}})
+        string(TOUPPER ${DEP} UDEP)
+        if(BOOST_${UDEP}_IS_MODULAR)
+          if (THIS_PROJECT_MODULAR AND CPACK_COMPONENT_BOOST_${UDEP}_LIBRARIES_GROUP)
+            # Make this project's libraries depend on DEP's headers
+            list(APPEND CPACK_COMPONENT_BOOST_${ULIBNAME}_LIBRARIES_DEPENDS ${UDEP}_libraries)
+          endif ()
+        endif()
+      endforeach()
+      if (CPACK_COMPONENT_BOOST_${ULIBNAME}_LIBRARIES_DEPENDS)
+        set(CPACK_COMPONENT_BOOST_${ULIBNAME}_LIBRARIES_DEPENDS 
+          ${CPACK_COMPONENT_BOOST_${ULIBNAME}_LIBRARIES_DEPENDS} PARENT_SCOPE)
+        set(THIS_PROJECT_EXPORT_MACROS ${THIS_PROJECT_EXPORT_MACROS} 
+	      CPACK_COMPONENT_BOOST_${ULIBNAME}_LIBRARIES_DEPENDS
+          CPACK_COMPONENT_BOOST_${ULIBNAME}_LIBRARIES_DISPLAY_NAME
+	      CPACK_COMPONENT_BOOST_${ULIBNAME}_LIBRARIES_GROUP
+	      PARENT_SCOPE)
+      else()
+        set(THIS_PROJECT_EXPORT_MACROS ${THIS_PROJECT_EXPORT_MACROS} 
+          CPACK_COMPONENT_BOOST_${ULIBNAME}_LIBRARIES_DISPLAY_NAME
+	      CPACK_COMPONENT_BOOST_${ULIBNAME}_LIBRARIES_GROUP
+	      PARENT_SCOPE)
+      endif()
+	endif()
   endif (THIS_VARIANT_OKAY)
 endmacro(boost_library_variant)