Remove support for COMPONENTS ALL

This commit is contained in:
Peter Dimov
2026-06-29 13:03:52 +03:00
parent 15c2a54842
commit 1284f1eab1
+6 -79
View File
@@ -1,4 +1,4 @@
# Copyright 2019 Peter Dimov
# Copyright 2019, 2026 Peter Dimov
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt)
@@ -18,21 +18,6 @@
# header-only libraries. An alias, Boost::boost, for Boost::headers is
# provided for compatibility.
#
# Requesting the special component "ALL" will make all installed components
# available, as in the following example:
#
# find_package(Boost 1.73 REQUIRED COMPONENTS ALL)
#
# Since COMPONENTS is optional when REQUIRED is specified, the above can be
# shortened to
#
# find_package(Boost 1.73 REQUIRED ALL)
#
# When ALL is used, a variable Boost_ALL_TARGETS will be set and will contain
# the names of all created targets.
#
# The ALL component cannot be combined with named components.
#
# Since Boost libraries can coexist in many variants - 32/64 bit,
# static/dynamic runtime, debug/release, the following variables can be used
# to control which variant is chosen:
@@ -174,42 +159,6 @@ macro(boost_find_component comp required quiet)
endmacro()
macro(boost_find_all_components)
# Search for all available component-configuration directories...
file(GLOB __boost_all_components
LIST_DIRECTORIES true RELATIVE "${CMAKE_CURRENT_LIST_DIR}/.."
"${CMAKE_CURRENT_LIST_DIR}/../boost_*-${Boost_VERSION}")
# ...and extract component names from it.
string(REGEX REPLACE "boost_([_a-z0-9]+)-${Boost_VERSION}" "\\1"
__boost_all_components "${__boost_all_components}")
if(Boost_DEBUG)
message(STATUS "BoostConfig: discovered components: ${__boost_all_components}")
endif()
list(REMOVE_ITEM __boost_all_components "headers")
# Try to find each component.
foreach(__boost_comp IN LISTS __boost_all_components)
boost_find_component(${__boost_comp} 0 1)
# Append to list of all targets (if found).
if(Boost_${__boost_comp}_FOUND)
list(APPEND Boost_ALL_TARGETS Boost::${__boost_comp})
endif()
endforeach()
unset(__boost_all_components)
if(Boost_DEBUG)
message(STATUS "BoostConfig: Boost_ALL_TARGETS: ${Boost_ALL_TARGETS}")
endif()
endmacro()
# Find boost_headers
boost_find_component(headers 1 0)
@@ -236,34 +185,17 @@ get_target_property(Boost_INCLUDE_DIRS Boost::headers INTERFACE_INCLUDE_DIRECTOR
set(Boost_LIBRARIES "")
# Save project's policies
cmake_policy(PUSH)
cmake_policy(SET CMP0057 NEW) # if IN_LIST
# Find components
if("ALL" IN_LIST Boost_FIND_COMPONENTS)
foreach(__boost_comp IN LISTS Boost_FIND_COMPONENTS)
# Make sure "ALL" is the only requested component.
list(LENGTH Boost_FIND_COMPONENTS __boost_find_components_count)
if(NOT ${__boost_find_components_count} EQUAL 1)
message(AUTHOR_WARNING "ALL cannot be combined with named components; the named components will be ignored.")
endif()
boost_find_component(${__boost_comp} ${Boost_FIND_REQUIRED_${__boost_comp}} 0)
unset(__boost_find_components_count)
set(Boost_ALL_TARGETS Boost::headers)
boost_find_all_components()
else()
foreach(__boost_comp IN LISTS Boost_FIND_COMPONENTS)
boost_find_component(${__boost_comp} ${Boost_FIND_REQUIRED_${__boost_comp}} 0)
endforeach()
endif()
endforeach()
# Compatibility targets
@@ -286,11 +218,6 @@ if(NOT TARGET Boost::boost)
endif()
# Compatibility variable when using meta-component "ALL"
if("ALL" IN_LIST Boost_FIND_COMPONENTS)
set(Boost_ALL_FOUND ${boost_headers_FOUND})
endif()
# Restore project's policies
cmake_policy(POP)