11# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
2- # file Copyright.txt or https://cmake.org/licensing for details.
2+ # file LICENSE.rst or https://cmake.org/licensing for details.
33
44#[=======================================================================[.rst:
55FindBoost
66---------
77
8+ .. versionchanged:: 3.30
9+ This module is available only if policy :policy:`CMP0167` is not set to
10+ ``NEW``. Port projects to upstream Boost's ``BoostConfig.cmake`` package
11+ configuration file, for which ``find_package(Boost)`` now searches.
12+
813Find Boost include dirs and libraries
914
1015Use this module by invoking :command:`find_package` with the form:
@@ -379,6 +384,18 @@ the Boost CMake package configuration for details on what it provides.
379384Set ``Boost_NO_BOOST_CMAKE`` to ``ON``, to disable the search for boost-cmake.
380385#]=======================================================================]
381386
387+ if (POLICY CMP0167)
388+ cmake_policy (GET CMP0167 _FindBoost_CMP0167)
389+ if (_FindBoost_CMP0167 STREQUAL "NEW" )
390+ message (FATAL_ERROR "The FindBoost module has been removed by policy CMP0167." )
391+ endif ()
392+ endif ()
393+
394+ if (_FindBoost_testing)
395+ set (_FindBoost_included TRUE )
396+ return ()
397+ endif ()
398+
382399# The FPHSA helper provides standard way of reporting final search results to
383400# the user including the version and component checks.
384401include (FindPackageHandleStandardArgs)
@@ -389,6 +406,9 @@ cmake_policy(SET CMP0057 NEW) # if IN_LIST
389406if (POLICY CMP0102)
390407 cmake_policy (SET CMP0102 NEW) # if mark_as_advanced(non_cache_var)
391408endif ()
409+ if (POLICY CMP0159)
410+ cmake_policy (SET CMP0159 NEW) # file(STRINGS) with REGEX updates CMAKE_MATCH_<n>
411+ endif ()
392412
393413function (_boost_get_existing_target component target_var)
394414 set (names "${component} " )
@@ -1380,7 +1400,7 @@ function(_Boost_COMPONENT_DEPENDENCIES component _ret)
13801400 set (_Boost_TIMER_DEPENDENCIES chrono)
13811401 set (_Boost_WAVE_DEPENDENCIES filesystem serialization thread chrono atomic)
13821402 set (_Boost_WSERIALIZATION_DEPENDENCIES serialization)
1383- elseif (Boost_VERSION_STRING VERSION_LESS 1.84 .0)
1403+ elseif (Boost_VERSION_STRING VERSION_LESS 1.87 .0)
13841404 set (_Boost_CONTRACT_DEPENDENCIES thread chrono)
13851405 set (_Boost_COROUTINE_DEPENDENCIES context)
13861406 set (_Boost_FIBER_DEPENDENCIES context)
@@ -1392,7 +1412,6 @@ function(_Boost_COMPONENT_DEPENDENCIES component _ret)
13921412 set (_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization)
13931413 set (_Boost_NUMPY_DEPENDENCIES python${component_python_version} )
13941414 set (_Boost_THREAD_DEPENDENCIES chrono atomic)
1395- set (_Boost_TIMER_DEPENDENCIES chrono)
13961415 set (_Boost_WAVE_DEPENDENCIES filesystem serialization thread chrono atomic)
13971416 set (_Boost_WSERIALIZATION_DEPENDENCIES serialization)
13981417 else ()
@@ -1401,15 +1420,16 @@ function(_Boost_COMPONENT_DEPENDENCIES component _ret)
14011420 set (_Boost_FIBER_DEPENDENCIES context)
14021421 set (_Boost_IOSTREAMS_DEPENDENCIES regex )
14031422 set (_Boost_JSON_DEPENDENCIES container)
1404- set (_Boost_LOG_DEPENDENCIES log_setup filesystem thread regex chrono atomic)
1423+ set (_Boost_LOG_DEPENDENCIES log_setup filesystem thread regex atomic)
14051424 set (_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l)
14061425 set (_Boost_MPI_DEPENDENCIES serialization)
14071426 set (_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization)
14081427 set (_Boost_NUMPY_DEPENDENCIES python${component_python_version} )
1428+ set (_Boost_PROCESS_DEPENDENCIES filesystem)
14091429 set (_Boost_THREAD_DEPENDENCIES chrono atomic)
14101430 set (_Boost_WAVE_DEPENDENCIES filesystem serialization thread chrono atomic)
14111431 set (_Boost_WSERIALIZATION_DEPENDENCIES serialization)
1412- if (Boost_VERSION_STRING VERSION_GREATER_EQUAL 1.88 .0 AND NOT Boost_NO_WARN_NEW_VERSIONS)
1432+ if (Boost_VERSION_STRING VERSION_GREATER_EQUAL 1.89 .0 AND NOT Boost_NO_WARN_NEW_VERSIONS)
14131433 message (WARNING "New Boost version may have incorrect or missing dependencies and imported targets" )
14141434 endif ()
14151435 endif ()
0 commit comments