summaryrefslogtreecommitdiff
path: root/Modules/CheckLinkerFlag.cmake
diff options
context:
space:
mode:
authorThomas Dickerson <elfprince13@gmail.com>2021-11-04 10:59:10 -0400
committerBrad King <brad.king@kitware.com>2021-11-04 14:01:09 -0400
commit58c8d649e178ad775012dfdf75a5118cbd2de23a (patch)
treef6449cf0014d94c29145862ab21d8335b1b1bd2f /Modules/CheckLinkerFlag.cmake
parentfda948846b200336395c0e99be3fa2a0258d7f0a (diff)
downloadcmake-58c8d649e178ad775012dfdf75a5118cbd2de23a.tar.gz
CheckLinkerFlag: Set policies needed by the implementation
The module was added in CMake 3.18 by commit af96c0f4fa (CheckLinkerFlag: Add module to check validity of linker flags, 2020-05-16, v3.18.0-rc1~103^2), but it is still possible for projects to use it without setting policies to the 3.18 version level.
Diffstat (limited to 'Modules/CheckLinkerFlag.cmake')
-rw-r--r--Modules/CheckLinkerFlag.cmake6
1 files changed, 6 insertions, 0 deletions
diff --git a/Modules/CheckLinkerFlag.cmake b/Modules/CheckLinkerFlag.cmake
index 28ac2e32e2..e85e43e9b6 100644
--- a/Modules/CheckLinkerFlag.cmake
+++ b/Modules/CheckLinkerFlag.cmake
@@ -41,6 +41,10 @@ include_guard(GLOBAL)
include(CMakeCheckCompilerFlagCommonPatterns)
+cmake_policy(PUSH)
+cmake_policy(SET CMP0054 NEW) # if() quoted variables not dereferenced
+cmake_policy(SET CMP0057 NEW) # if() supports IN_LIST
+
function(CHECK_LINKER_FLAG _lang _flag _var)
get_property (_supported_languages GLOBAL PROPERTY ENABLED_LANGUAGES)
if (NOT _lang IN_LIST _supported_languages)
@@ -82,3 +86,5 @@ function(CHECK_LINKER_FLAG _lang _flag _var)
endforeach()
set(${_var} "${${_var}}" PARENT_SCOPE)
endfunction()
+
+cmake_policy(POP)