summaryrefslogtreecommitdiff
path: root/Modules
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2020-12-04 09:54:12 -0500
committerCraig Scott <craig.scott@crascit.com>2020-12-05 21:57:08 +1100
commitda7ad7997e383eda8532d91269130524158a0a86 (patch)
tree2579e0c76e5201f5904a8fd5a47ec75af96af98e /Modules
parent541f1410e06bc8c28876c6eb6dff594f6b046fc2 (diff)
downloadcmake-da7ad7997e383eda8532d91269130524158a0a86.tar.gz
WriteCompilerDetectionHeader: Add policy to remove module
See justification in the policy documentation. Closes: #17842
Diffstat (limited to 'Modules')
-rw-r--r--Modules/WriteCompilerDetectionHeader.cmake16
1 files changed, 16 insertions, 0 deletions
diff --git a/Modules/WriteCompilerDetectionHeader.cmake b/Modules/WriteCompilerDetectionHeader.cmake
index 650c02e595..5e6828f3bb 100644
--- a/Modules/WriteCompilerDetectionHeader.cmake
+++ b/Modules/WriteCompilerDetectionHeader.cmake
@@ -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)