Changeset 44658


Ignore:
Timestamp:
Apr 20, 2008, 11:41:40 PM (10 years ago)
Author:
Douglas Gregor
Message:
  • 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.
Location:
branches/CMake/release
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/CMake/release/CMakeLists.txt

    r44031 r44658  
    9797install(DIRECTORY boost
    9898        DESTINATION ${BOOST_HEADER_DIR}
     99        COMPONENT Core
    99100        PATTERN "CVS" EXCLUDE
    100101        REGEX ".svn" EXCLUDE)
     
    103104  install(EXPORT boost-targets DESTINATION "lib/Boost${BOOST_VERSION}")
    104105endif (NOT TEST_INSTALLED_TREE)
    105 
    106 ##########################################################################
    107 
    108 ##########################################################################
    109 # Binary packages                                                        #
    110 ##########################################################################
    111 set(CPACK_PACKAGE_NAME "Boost")
    112 set(CPACK_PACKAGE_VENDOR "Boost.org")
    113 set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Boost")
    114 set(CPACK_PACKAGE_DESCRIPTION_FILE "${Boost_SOURCE_DIR}/README.txt")
    115 set(CPACK_RESOURCE_FILE_README "${Boost_SOURCE_DIR}/README.txt")
    116 set(CPACK_RESOURCE_FILE_LICENSE "${Boost_SOURCE_DIR}/LICENSE_1_0.txt")
    117 set(CPACK_RESOURCE_FILE_WELCOME "${Boost_SOURCE_DIR}/Welcome.txt")
    118 set(CPACK_PACKAGE_VERSION "${BOOST_VERSION}")
    119 set(CPACK_PACKAGE_VERSION_MAJOR "${BOOST_VERSION_MAJOR}")
    120 set(CPACK_PACKAGE_VERSION_MINOR "${BOOST_VERSION_MINOR}")
    121 set(CPACK_PACKAGE_VERSION_PATCH "${BOOST_VERSION_SUBMINOR}")
    122 set(CPACK_PACKAGE_INSTALL_DIRECTORY "Boost")
    123 if(WIN32 AND NOT UNIX)
    124   # There is a bug in NSI that does not handle full unix paths properly. Make
    125   # sure there is at least one set of four (4) backlasshes.
    126   # NOTE: No Boost icon yet
    127 #  set(CPACK_PACKAGE_ICON "${Boost_SOURCE_DIR}/tools/build/CMake\\\\InstallIcon.bmp")
    128 #  set(CPACK_NSIS_INSTALLED_ICON_NAME "bin\\\\MyExecutable.exe")
    129   set(CPACK_NSIS_DISPLAY_NAME "Boost ${BOOST_VERSION_MAJOR}.${BOOST_VERSION_MINOR}.${BOOST_VERSION_SUBMINOR}")
    130   set(CPACK_NSIS_HELP_LINK "http:\\\\\\\\www.boost.org")
    131   set(CPACK_NSIS_URL_INFO_ABOUT "http:\\\\\\\\www.boost.org")
    132   set(CPACK_NSIS_CONTACT "boost-users@lists.boost.org")
    133   set(CPACK_NSIS_MODIFY_PATH ON)
    134  
    135   # Encode the compiler name in the package
    136   if (MSVC60)
    137     set(CPACK_PACKAGE_FILE_NAME "Boost-${BOOST_VERSION}-vc6")
    138   elseif (MSVC70)
    139     set(CPACK_PACKAGE_FILE_NAME "Boost-${BOOST_VERSION}-vc7")
    140   elseif (MSVC71)
    141     set(CPACK_PACKAGE_FILE_NAME "Boost-${BOOST_VERSION}-vc71")
    142   elseif (MSVC80)
    143     set(CPACK_PACKAGE_FILE_NAME "Boost-${BOOST_VERSION}-vc8")
    144   elseif (MSVC90)
    145     set(CPACK_PACKAGE_FILE_NAME "Boost-${BOOST_VERSION}-vc9")
    146   elseif (BORLAND)
    147     set(CPACK_PACKAGE_FILE_NAME "Boost-${BOOST_VERSION}-borland") 
    148   endif (MSVC60)
    149 endif(WIN32 AND NOT UNIX)
    150 include(CPack)
    151106##########################################################################
    152107
     
    183138# add_subdirectory(tools)
    184139##########################################################################
     140
     141##########################################################################
     142# Binary packages                                                        #
     143##########################################################################
     144set(CPACK_PACKAGE_NAME "Boost")
     145set(CPACK_PACKAGE_VENDOR "Boost.org")
     146set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Boost")
     147set(CPACK_PACKAGE_DESCRIPTION_FILE "${Boost_SOURCE_DIR}/README.txt")
     148set(CPACK_RESOURCE_FILE_README "${Boost_SOURCE_DIR}/README.txt")
     149set(CPACK_RESOURCE_FILE_LICENSE "${Boost_SOURCE_DIR}/LICENSE_1_0.txt")
     150set(CPACK_RESOURCE_FILE_WELCOME "${Boost_SOURCE_DIR}/Welcome.txt")
     151set(CPACK_PACKAGE_VERSION "${BOOST_VERSION}")
     152set(CPACK_PACKAGE_VERSION_MAJOR "${BOOST_VERSION_MAJOR}")
     153set(CPACK_PACKAGE_VERSION_MINOR "${BOOST_VERSION_MINOR}")
     154set(CPACK_PACKAGE_VERSION_PATCH "${BOOST_VERSION_SUBMINOR}")
     155set(CPACK_PACKAGE_INSTALL_DIRECTORY "Boost")
     156
     157# Setup "core" component
     158if (CPACK_COMPONENTS_BOOST_ALL)
     159  list(SORT CPACK_COMPONENTS_BOOST_ALL)
     160endif ()
     161set(CPACK_COMPONENTS_BOOST_ALL "Core" ${CPACK_COMPONENTS_BOOST_ALL})
     162set(CPACK_COMPONENT_BOOST_CORE_REQUIRED ON)
     163set(CPACK_COMPONENT_BOOST_CORE_DISPLAY_NAME "Core libraries")
     164set(CPACK_COMPONENT_BOOST_CORE_DESCRIPTION
     165  "The headers and core library binaries required to use Boost")
     166
     167if(WIN32 AND NOT UNIX)
     168  # There is a bug in NSI that does not handle full unix paths properly. Make
     169  # sure there is at least one set of four (4) backlasshes.
     170  # NOTE: No Boost icon yet
     171#  set(CPACK_PACKAGE_ICON "${Boost_SOURCE_DIR}/tools/build/CMake\\\\InstallIcon.bmp")
     172#  set(CPACK_NSIS_INSTALLED_ICON_NAME "bin\\\\MyExecutable.exe")
     173  set(CPACK_NSIS_DISPLAY_NAME "Boost ${BOOST_VERSION_MAJOR}.${BOOST_VERSION_MINOR}.${BOOST_VERSION_SUBMINOR}")
     174  set(CPACK_NSIS_HELP_LINK "http:\\\\\\\\www.boost.org")
     175  set(CPACK_NSIS_URL_INFO_ABOUT "http:\\\\\\\\www.boost.org")
     176  set(CPACK_NSIS_CONTACT "boost-users@lists.boost.org")
     177  set(CPACK_NSIS_MODIFY_PATH ON)
     178 
     179  # Encode the compiler name in the package
     180  if (MSVC60)
     181    set(CPACK_PACKAGE_FILE_NAME "Boost-${BOOST_VERSION}-vc6")
     182  elseif (MSVC70)
     183    set(CPACK_PACKAGE_FILE_NAME "Boost-${BOOST_VERSION}-vc7")
     184  elseif (MSVC71)
     185    set(CPACK_PACKAGE_FILE_NAME "Boost-${BOOST_VERSION}-vc71")
     186  elseif (MSVC80)
     187    set(CPACK_PACKAGE_FILE_NAME "Boost-${BOOST_VERSION}-vc8")
     188  elseif (MSVC90)
     189    set(CPACK_PACKAGE_FILE_NAME "Boost-${BOOST_VERSION}-vc9")
     190  elseif (BORLAND)
     191    set(CPACK_PACKAGE_FILE_NAME "Boost-${BOOST_VERSION}-borland") 
     192  endif (MSVC60)
     193endif(WIN32 AND NOT UNIX)
     194include(CPack)
     195##########################################################################
  • branches/CMake/release/libs/CMakeLists.txt

    r44456 r44658  
    3333# Add all of the Boost projects in reverse topological order, so that
    3434# a library's dependencies show up before the library itself.
     35set(CPACK_INSTALL_CMAKE_COMPONENTS_ALL)
    3536list(SORT BOOST_SUBPROJECT_DIRS)
    3637topological_sort(BOOST_SUBPROJECT_DIRS BOOST_ _DEPENDS)
    3738add_subdirectories(" + " ${BOOST_SUBPROJECT_DIRS})
     39
     40# Export the list of components to be installed
     41set(CPACK_COMPONENTS_BOOST_ALL ${CPACK_COMPONENTS_BOOST_ALL} PARENT_SCOPE)
     42set(CPACK_COMPONENT_GROUPS_BOOST_ALL ${CPACK_COMPONENT_GROUPS_BOOST_ALL} PARENT_SCOPE)
     43
     44# Export all of the variables that have been marked as "to be exported"
     45foreach(MACRO ${BOOST_EXPORT_MACROS})
     46  set(${MACRO} ${${MACRO}} PARENT_SCOPE)
     47endforeach()
  • branches/CMake/release/tools/build/CMake/BoostCore.cmake

    r44457 r44658  
    6666    )
    6767
     68  # The names of all of the macros that need to be exported to the outer scope.
     69  set(THIS_PROJECT_EXPORT_MACROS)
     70 
    6871  set(THIS_PROJECT_OKAY ON)
    6972  string(TOUPPER "BOOST_${LIBNAME}_DEPENDS" THIS_PROJECT_DEPENDS)
     
    105108  if(${BOOST_BUILD_LIB_OPTION} AND THIS_PROJECT_OKAY)
    106109    string(TOLOWER "${LIBNAME}" libname)
    107     project(${libname})
    108 
     110    string(TOUPPER "${LIBNAME}" ULIBNAME)
     111    project(${LIBNAME})
     112
     113    if(THIS_PROJECT_MODULAR OR THIS_PROJECT_SRCDIRS)
     114      # Add this library to the list of library components to install
     115      set(CPACK_COMPONENT_GROUPS_BOOST_ALL ${CPACK_COMPONENT_GROUPS_BOOST_ALL} ${ULIBNAME} PARENT_SCOPE)
     116      set(CPACK_COMPONENT_GROUP_BOOST_${ULIBNAME}_DISPLAY_NAME ${LIBNAME})
     117      list(APPEND THIS_PROJECT_EXPORT_MACROS CPACK_COMPONENT_GROUP_BOOST_${ULIBNAME}_DISPLAY_NAME)
     118    endif(THIS_PROJECT_MODULAR OR THIS_PROJECT_SRCDIRS)
     119   
    109120    if(THIS_PROJECT_MODULAR)
    110121      # If this is a modular project, set a variable
     
    112123      # other libraries know that this is a modular library. Thus,
    113124      # they will add the appropriate include paths.
    114       string(TOUPPER "BOOST_${LIBNAME}_IS_MODULAR" THIS_PROJECT_IS_MODULAR)
    115       set(${THIS_PROJECT_IS_MODULAR} TRUE CACHE INTERNAL "" FORCE)
     125      set(BOOST_${ULIBNAME}_IS_MODULAR TRUE PARENT_SCOPE)
    116126
    117127      # Add this module's include directory
     
    121131      install(DIRECTORY include/boost
    122132        DESTINATION ${BOOST_HEADER_DIR}
    123         COMPONENT ${LIBNAME}
     133        COMPONENT ${ULIBNAME}_headers
    124134        PATTERN "CVS" EXCLUDE
    125135        REGEX ".svn" EXCLUDE)
     136             
     137      # Add the appropriate variables to make this library's headers a separate component.
     138      set(THIS_PROJECT_COMPONENTS ${THIS_PROJECT_COMPONENTS} ${ULIBNAME}_headers)
     139      set(CPACK_COMPONENT_BOOST_${ULIBNAME}_HEADERS_DISPLAY_NAME "Header files")
     140      set(CPACK_COMPONENT_BOOST_${ULIBNAME}_HEADERS_GROUP ${ULIBNAME})
     141      list(APPEND THIS_PROJECT_EXPORT_MACROS
     142                CPACK_COMPONENT_BOOST_${ULIBNAME}_HEADERS_DISPLAY_NAME
     143                CPACK_COMPONENT_BOOST_${ULIBNAME}_HEADERS_GROUP)
    126144    endif (THIS_PROJECT_MODULAR)
    127145
     
    129147    # add the include path for that library.
    130148    foreach(DEP ${${THIS_PROJECT_DEPENDS}})
     149      string(TOUPPER ${DEP} UDEP)
    131150      string(TOUPPER "BOOST_${DEP}_IS_MODULAR" BOOST_LIB_DEP_MODULAR)
    132       if(${BOOST_LIB_DEP_MODULAR})
     151      if(BOOST_${UDEP}_IS_MODULAR)
    133152        include_directories("${Boost_SOURCE_DIR}/libs/${DEP}/include")
    134       endif(${BOOST_LIB_DEP_MODULAR})
     153        if (THIS_PROJECT_MODULAR)
     154          # Make this project's headers depend on DEP's headers
     155          list(APPEND CPACK_COMPONENT_BOOST_${ULIBNAME}_HEADERS_DEPENDS ${UDEP}_headers)
     156        endif ()
     157      endif()
    135158    endforeach(DEP)
     159    if (CPACK_COMPONENT_BOOST_${ULIBNAME}_HEADERS_DEPENDS)
     160      list(APPEND THIS_PROJECT_EXPORT_MACROS CPACK_COMPONENT_BOOST_${ULIBNAME}_HEADERS_DEPENDS)
     161    endif ()
    136162
    137163    if(NOT EXISTS ${CMAKE_BINARY_DIR}/bin/tests)
     
    164190    endif(BUILD_TESTING AND THIS_PROJECT_TESTDIRS)
    165191  endif(${BOOST_BUILD_LIB_OPTION} AND THIS_PROJECT_OKAY)
     192 
     193  # Export certain macros to the parent scope.
     194  foreach(MACRO ${THIS_PROJECT_EXPORT_MACROS})
     195    set(${MACRO} ${${MACRO}} PARENT_SCOPE)
     196  endforeach()
     197  set(BOOST_EXPORT_MACROS
     198        ${BOOST_EXPORT_MACROS} ${THIS_PROJECT_EXPORT_MACROS} PARENT_SCOPE)
     199  set(CPACK_COMPONENTS_BOOST_ALL
     200        ${CPACK_COMPONENTS_BOOST_ALL} ${THIS_PROJECT_COMPONENTS} PARENT_SCOPE)
    166201endmacro(boost_library_project)
    167202
     
    453488
    454489    # Installation of this library variant
     490    string(TOUPPER ${PROJECT_NAME} ULIBNAME)
    455491    install(TARGETS ${VARIANT_LIBNAME} DESTINATION lib
    456492      EXPORT boost-targets
    457       COMPONENT ${PROJECT_NAME})
     493      COMPONENT ${ULIBNAME}_libraries)
     494     
     495    # Add the appropriate variables to make this library's binaries a separate component.
     496    if (NOT THIS_PROJECT_ADDED_LIBRARIES_COMPONENT)
     497      set(THIS_PROJECT_ADDED_LIBRARIES_COMPONENT ON)
     498      set(THIS_PROJECT_COMPONENTS ${THIS_PROJECT_COMPONENTS} ${ULIBNAME}_libraries PARENT_SCOPE)
     499      set(CPACK_COMPONENT_BOOST_${ULIBNAME}_LIBRARIES_DISPLAY_NAME "Library binaries" PARENT_SCOPE)
     500      set(CPACK_COMPONENT_BOOST_${ULIBNAME}_LIBRARIES_GROUP ${ULIBNAME} PARENT_SCOPE)
     501         
     502          # Make the library installation component dependent on the library installation
     503          # components of dependent libraries. 
     504          foreach(DEP ${${THIS_PROJECT_DEPENDS}})
     505        string(TOUPPER ${DEP} UDEP)
     506        if(BOOST_${UDEP}_IS_MODULAR)
     507          if (THIS_PROJECT_MODULAR AND CPACK_COMPONENT_BOOST_${UDEP}_LIBRARIES_GROUP)
     508            # Make this project's libraries depend on DEP's headers
     509            list(APPEND CPACK_COMPONENT_BOOST_${ULIBNAME}_LIBRARIES_DEPENDS ${UDEP}_libraries)
     510          endif ()
     511        endif()
     512      endforeach()
     513      if (CPACK_COMPONENT_BOOST_${ULIBNAME}_LIBRARIES_DEPENDS)
     514        set(CPACK_COMPONENT_BOOST_${ULIBNAME}_LIBRARIES_DEPENDS
     515          ${CPACK_COMPONENT_BOOST_${ULIBNAME}_LIBRARIES_DEPENDS} PARENT_SCOPE)
     516        set(THIS_PROJECT_EXPORT_MACROS ${THIS_PROJECT_EXPORT_MACROS}
     517              CPACK_COMPONENT_BOOST_${ULIBNAME}_LIBRARIES_DEPENDS
     518          CPACK_COMPONENT_BOOST_${ULIBNAME}_LIBRARIES_DISPLAY_NAME
     519              CPACK_COMPONENT_BOOST_${ULIBNAME}_LIBRARIES_GROUP
     520              PARENT_SCOPE)
     521      else()
     522        set(THIS_PROJECT_EXPORT_MACROS ${THIS_PROJECT_EXPORT_MACROS}
     523          CPACK_COMPONENT_BOOST_${ULIBNAME}_LIBRARIES_DISPLAY_NAME
     524              CPACK_COMPONENT_BOOST_${ULIBNAME}_LIBRARIES_GROUP
     525              PARENT_SCOPE)
     526      endif()
     527        endif()
    458528  endif (THIS_VARIANT_OKAY)
    459529endmacro(boost_library_variant)
Note: See TracChangeset for help on using the changeset viewer.