CheckLanguage: Avoid CMP0126 warning

The macro's implementation converts a normal variable into a cache
variable intentionally, so both are set.  Explicitly set CMP0126 to NEW
to avoid a warning in trace mode.  This won't affect the module behavior
because the code path does not activate if a normal variable is already
defined anyway.

Fixes: #22548
This commit is contained in:
Brad King
2021-08-18 15:24:30 -04:00
parent 3de5096094
commit 89ed11ae6f

View File

@@ -36,6 +36,9 @@ Example:
include_guard(GLOBAL)
cmake_policy(PUSH)
cmake_policy(SET CMP0126 NEW)
macro(check_language lang)
if(NOT DEFINED CMAKE_${lang}_COMPILER)
set(_desc "Looking for a ${lang} compiler")
@@ -110,3 +113,5 @@ file(WRITE \"\${CMAKE_CURRENT_BINARY_DIR}/result.cmake\"
endif()
endmacro()
cmake_policy(POP)