mirror of
https://github.com/Kitware/CMake.git
synced 2026-03-01 12:18:36 -06:00
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.
This commit is contained in:
committed by
Brad King
parent
fda948846b
commit
58c8d649e1
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user