FindBoost: Add policy to remove this module

Upstream Boost 1.70 and above provide a proper `BoostConfig.cmake`
package configuration file.  Packages for all major distros now
provide it in at least one LTS release.  Add a policy to pretend
that the `FindBoost` module does not exist so that projects calling
`find_package(Boost)` use the upstream package directly.

Closes: #19402
This commit is contained in:
Brad King
2024-05-03 09:43:21 -04:00
parent 1027c0e213
commit e0355c4ea9
24 changed files with 136 additions and 1 deletions
+15
View File
@@ -5,6 +5,11 @@
FindBoost
---------
.. versionchanged:: 3.30
This module is available only if policy :policy:`CMP0167` is not set to
``NEW``. Port projects to upstream Boost's ``BoostConfig.cmake`` package
configuration file, for which ``find_package(Boost)`` now searches.
Find Boost include dirs and libraries
Use this module by invoking :command:`find_package` with the form:
@@ -379,6 +384,16 @@ the Boost CMake package configuration for details on what it provides.
Set ``Boost_NO_BOOST_CMAKE`` to ``ON``, to disable the search for boost-cmake.
#]=======================================================================]
cmake_policy(GET CMP0167 _FindBoost_CMP0167)
if(_FindBoost_CMP0167 STREQUAL "NEW")
message(FATAL_ERROR "The FindBoost module has been removed by policy CMP0167.")
endif()
if(_FindBoost_testing)
set(_FindBoost_included TRUE)
return()
endif()
# The FPHSA helper provides standard way of reporting final search results to
# the user including the version and component checks.
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)