mirror of
https://github.com/Kitware/CMake.git
synced 2026-03-20 19:00:37 -05:00
FindBoost: Introduce CMP0093 to report Boost_VERSION in x.y.z format
This aligns module mode behaviour with config mode.
This commit is contained in:
@@ -57,6 +57,7 @@ Policies Introduced by CMake 3.15
|
|||||||
.. toctree::
|
.. toctree::
|
||||||
:maxdepth: 1
|
:maxdepth: 1
|
||||||
|
|
||||||
|
CMP0093: FindBoost reports Boost_VERSION in x.y.z format. </policy/CMP0093>
|
||||||
CMP0092: MSVC warning flags are not in CMAKE_{C,CXX}_FLAGS by default. </policy/CMP0092>
|
CMP0092: MSVC warning flags are not in CMAKE_{C,CXX}_FLAGS by default. </policy/CMP0092>
|
||||||
CMP0091: MSVC runtime library flags are selected by an abstraction. </policy/CMP0091>
|
CMP0091: MSVC runtime library flags are selected by an abstraction. </policy/CMP0091>
|
||||||
CMP0090: export(PACKAGE) does not populate package registry by default. </policy/CMP0090>
|
CMP0090: export(PACKAGE) does not populate package registry by default. </policy/CMP0090>
|
||||||
|
|||||||
24
Help/policy/CMP0093.rst
Normal file
24
Help/policy/CMP0093.rst
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
CMP0093
|
||||||
|
-------
|
||||||
|
|
||||||
|
:module:`FindBoost` reports ``Boost_VERSION`` in ``x.y.z`` format.
|
||||||
|
|
||||||
|
In CMake 3.14 and below the module would report the Boost version
|
||||||
|
number as specified in the preprocessor definition ``BOOST_VERSION`` in
|
||||||
|
the ``boost/version.hpp`` file. In CMake 3.15 and later it is preferred
|
||||||
|
that the reported version number matches the ``x.y.z`` format reported
|
||||||
|
by the CMake package shipped with Boost ``1.70.0`` and later. The macro
|
||||||
|
value is still reported in the ``Boost_VERSION_MACRO`` variable.
|
||||||
|
|
||||||
|
The ``OLD`` behavior for this policy is for :module:`FindBoost` to report
|
||||||
|
``Boost_VERSION`` as specified in the preprocessor definition
|
||||||
|
``BOOST_VERSION`` in ``boost/version.hpp``. The ``NEW`` behavior for this
|
||||||
|
policy is for :module:`FindBoost` to report ``Boost_VERSION`` in
|
||||||
|
``x.y.z`` format.
|
||||||
|
|
||||||
|
This policy was introduced in CMake version 3.15. Use the
|
||||||
|
:command:`cmake_policy` command to set it to ``OLD`` or ``NEW`` explicitly.
|
||||||
|
Unlike many policies, CMake version |release| does *not* warn
|
||||||
|
when this policy is not set and simply uses the ``OLD`` behavior.
|
||||||
|
|
||||||
|
.. include:: DEPRECATED.txt
|
||||||
@@ -29,3 +29,6 @@ FindBoost-fphsa
|
|||||||
|
|
||||||
* The input switch ``Boost_DETAILED_FAILURE_MSG`` was
|
* The input switch ``Boost_DETAILED_FAILURE_MSG`` was
|
||||||
removed.
|
removed.
|
||||||
|
|
||||||
|
* ``Boost_VERSION`` now reports the version in ``x.y.z``
|
||||||
|
format in module mode. See policy :policy:`CMP0093`.
|
||||||
|
|||||||
@@ -30,9 +30,10 @@ case results are reported in variables::
|
|||||||
Boost_<C>_FOUND - True if component <C> was found (<C> is upper-case)
|
Boost_<C>_FOUND - True if component <C> was found (<C> is upper-case)
|
||||||
Boost_<C>_LIBRARY - Libraries to link for component <C> (may include
|
Boost_<C>_LIBRARY - Libraries to link for component <C> (may include
|
||||||
target_link_libraries debug/optimized keywords)
|
target_link_libraries debug/optimized keywords)
|
||||||
Boost_VERSION - BOOST_VERSION value from boost/version.hpp
|
Boost_VERSION_MACRO - BOOST_VERSION value from boost/version.hpp
|
||||||
alias: Boost_VERSION_MACRO
|
|
||||||
Boost_VERSION_STRING - Boost version number in x.y.z format
|
Boost_VERSION_STRING - Boost version number in x.y.z format
|
||||||
|
Boost_VERSION - if CMP0093 NEW => same as Boost_VERSION_STRING
|
||||||
|
if CMP0093 OLD or unset => same as Boost_VERSION_MACRO
|
||||||
Boost_LIB_VERSION - Version string appended to library filenames
|
Boost_LIB_VERSION - Version string appended to library filenames
|
||||||
Boost_VERSION_MAJOR - Boost major version number (X in X.y.z)
|
Boost_VERSION_MAJOR - Boost major version number (X in X.y.z)
|
||||||
alias: Boost_MAJOR_VERSION
|
alias: Boost_MAJOR_VERSION
|
||||||
@@ -1427,7 +1428,15 @@ if(Boost_INCLUDE_DIR)
|
|||||||
set(Boost_VERSION_STRING "${Boost_VERSION_MAJOR}.${Boost_VERSION_MINOR}.${Boost_VERSION_PATCH}")
|
set(Boost_VERSION_STRING "${Boost_VERSION_MAJOR}.${Boost_VERSION_MINOR}.${Boost_VERSION_PATCH}")
|
||||||
|
|
||||||
# Define final Boost_VERSION
|
# Define final Boost_VERSION
|
||||||
set(Boost_VERSION ${Boost_VERSION_MACRO})
|
cmake_policy(GET CMP0093 _Boost_CMP0093
|
||||||
|
PARENT_SCOPE # undocumented, do not use outside of CMake
|
||||||
|
)
|
||||||
|
if("x${_Boost_CMP0093}x" STREQUAL "xNEWx")
|
||||||
|
set(Boost_VERSION ${Boost_VERSION_STRING})
|
||||||
|
else()
|
||||||
|
set(Boost_VERSION ${Boost_VERSION_MACRO})
|
||||||
|
endif()
|
||||||
|
unset(_Boost_CMP0093)
|
||||||
|
|
||||||
if(Boost_DEBUG)
|
if(Boost_DEBUG)
|
||||||
message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
|
message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
|
||||||
|
|||||||
@@ -273,7 +273,9 @@ class cmMakefile;
|
|||||||
0, cmPolicies::WARN) \
|
0, cmPolicies::WARN) \
|
||||||
SELECT(POLICY, CMP0092, \
|
SELECT(POLICY, CMP0092, \
|
||||||
"MSVC warning flags are not in CMAKE_<LANG>_FLAGS by default.", 3, \
|
"MSVC warning flags are not in CMAKE_<LANG>_FLAGS by default.", 3, \
|
||||||
15, 0, cmPolicies::WARN)
|
15, 0, cmPolicies::WARN) \
|
||||||
|
SELECT(POLICY, CMP0093, "FindBoost reports Boost_VERSION in x.y.z format.", \
|
||||||
|
3, 15, 0, cmPolicies::WARN)
|
||||||
|
|
||||||
#define CM_SELECT_ID(F, A1, A2, A3, A4, A5, A6) F(A1)
|
#define CM_SELECT_ID(F, A1, A2, A3, A4, A5, A6) F(A1)
|
||||||
#define CM_FOR_EACH_POLICY_ID(POLICY) \
|
#define CM_FOR_EACH_POLICY_ID(POLICY) \
|
||||||
|
|||||||
1
Tests/RunCMake/FindBoost/CMP0093-NEW-stdout.txt
Normal file
1
Tests/RunCMake/FindBoost/CMP0093-NEW-stdout.txt
Normal file
@@ -0,0 +1 @@
|
|||||||
|
-- Boost_VERSION=1.70.0
|
||||||
2
Tests/RunCMake/FindBoost/CMP0093-NEW.cmake
Normal file
2
Tests/RunCMake/FindBoost/CMP0093-NEW.cmake
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
cmake_policy(SET CMP0093 NEW)
|
||||||
|
include(ModuleMode.cmake)
|
||||||
1
Tests/RunCMake/FindBoost/CMP0093-OLD-stdout.txt
Normal file
1
Tests/RunCMake/FindBoost/CMP0093-OLD-stdout.txt
Normal file
@@ -0,0 +1 @@
|
|||||||
|
-- Boost_VERSION=107000
|
||||||
2
Tests/RunCMake/FindBoost/CMP0093-OLD.cmake
Normal file
2
Tests/RunCMake/FindBoost/CMP0093-OLD.cmake
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
cmake_policy(SET CMP0093 OLD)
|
||||||
|
include(ModuleMode.cmake)
|
||||||
1
Tests/RunCMake/FindBoost/CMP0093-UNSET-stdout.txt
Normal file
1
Tests/RunCMake/FindBoost/CMP0093-UNSET-stdout.txt
Normal file
@@ -0,0 +1 @@
|
|||||||
|
-- Boost_VERSION=107000
|
||||||
1
Tests/RunCMake/FindBoost/CMP0093-UNSET.cmake
Normal file
1
Tests/RunCMake/FindBoost/CMP0093-UNSET.cmake
Normal file
@@ -0,0 +1 @@
|
|||||||
|
include(ModuleMode.cmake)
|
||||||
@@ -14,3 +14,7 @@ run_cmake(ConfigModeNotFound)
|
|||||||
run_cmake(ModuleModeNotFound)
|
run_cmake(ModuleModeNotFound)
|
||||||
unset(RunCMake-stdout-file)
|
unset(RunCMake-stdout-file)
|
||||||
unset(RunCMake-stderr-file)
|
unset(RunCMake-stderr-file)
|
||||||
|
|
||||||
|
run_cmake(CMP0093-NEW)
|
||||||
|
run_cmake(CMP0093-OLD)
|
||||||
|
run_cmake(CMP0093-UNSET)
|
||||||
|
|||||||
Reference in New Issue
Block a user