WriteCompilerDetectionHeader: Add policy to remove module

See justification in the policy documentation.

Closes: #17842
This commit is contained in:
Brad King
2020-12-04 09:54:12 -05:00
committed by Craig Scott
parent 541f1410e0
commit da7ad7997e
21 changed files with 137 additions and 2 deletions

View File

@@ -5,6 +5,10 @@
WriteCompilerDetectionHeader
----------------------------
.. deprecated:: 3.20
This module is available only if policy :policy:`CMP0120`
is not set to ``NEW``. Do not use it in new code.
.. versionadded:: 3.1
This module provides the function ``write_compiler_detection_header()``.
@@ -243,6 +247,18 @@ library:
)
#]=======================================================================]
# Guard against inclusion by absolute path.
cmake_policy(GET CMP0120 _WCDH_policy)
if(_WCDH_policy STREQUAL "NEW")
message(FATAL_ERROR "The WriteCompilerDetectionHeader module has been removed by policy CMP0120.")
elseif(_WCDH_policy STREQUAL "")
message(AUTHOR_WARNING
"The WriteCompilerDetectionHeader module will be removed by policy CMP0120. "
"Projects should be ported away from the module, perhaps by bundling a copy "
"of the generated header or using a third-party alternative."
)
endif()
include(${CMAKE_CURRENT_LIST_DIR}/CMakeCompilerIdDetection.cmake)
function(_load_compiler_variables CompilerId lang)