summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2021-07-08 11:46:16 (GMT)
committerBrad King <brad.king@kitware.com>2021-07-08 11:46:16 (GMT)
commit93b25f0bd507ecd1d2b61759d8656b3e8d8de1ba (patch)
treeacf2e8661fad01c364c785392e5dd0ac04a5d7dd
parentc9b27dace7e4110b25d5889e9c6952d0f4a7ca58 (diff)
parent018d300ca03c6ecea6b6b15d8c5caa7693eef84b (diff)
downloadCMake-93b25f0bd507ecd1d2b61759d8656b3e8d8de1ba.zip
CMake-93b25f0bd507ecd1d2b61759d8656b3e8d8de1ba.tar.gz
CMake-93b25f0bd507ecd1d2b61759d8656b3e8d8de1ba.tar.bz2
Merge branch 'check_cxx_compiler_flag_no_normal_variable' into release-3.19
Merge-request: !6318
-rw-r--r--Modules/Internal/CheckCompilerFlag.cmake1
-rw-r--r--Tests/TryCompile/CMakeLists.txt10
2 files changed, 10 insertions, 1 deletions
diff --git a/Modules/Internal/CheckCompilerFlag.cmake b/Modules/Internal/CheckCompilerFlag.cmake
index 6b2a11e..99efc37 100644
--- a/Modules/Internal/CheckCompilerFlag.cmake
+++ b/Modules/Internal/CheckCompilerFlag.cmake
@@ -73,7 +73,6 @@ int main(void) { return 0; }]=])
foreach(v IN LISTS _locale_vars)
set(ENV{${v}} ${_locale_vars_saved_${v}})
endforeach()
- set(${_var} "${${_var}}" PARENT_SCOPE)
endfunction ()
cmake_policy(POP)
diff --git a/Tests/TryCompile/CMakeLists.txt b/Tests/TryCompile/CMakeLists.txt
index 0c6b938..0d44f21 100644
--- a/Tests/TryCompile/CMakeLists.txt
+++ b/Tests/TryCompile/CMakeLists.txt
@@ -305,11 +305,21 @@ unset(C_BOGUS_FLAG CACHE)
include(CheckCCompilerFlag)
CHECK_C_COMPILER_FLAG(${C_DD}-_this_is_not_a_flag_ C_BOGUS_FLAG)
TEST_FAIL(C_BOGUS_FLAG "CHECK_C_COMPILER_FLAG() succeeded, but should have failed")
+unset(C_BOGUS_FLAG CACHE)
+if(DEFINED C_BOGUS_FLAG)
+ # Verify that CHECK_C_COMPILER_FLAG didn't construct a normal variable
+ message(SEND_ERROR "CHECK_C_COMPILER_FLAG shouldn't construct C_BOGUS_FLAG as a normal variable")
+endif()
unset(CXX_BOGUS_FLAG CACHE)
include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG(${CXX_DD}-_this_is_not_a_flag_ CXX_BOGUS_FLAG)
TEST_FAIL(CXX_BOGUS_FLAG "CHECK_CXX_COMPILER_FLAG() succeeded, but should have failed")
+unset(CXX_BOGUS_FLAG CACHE)
+if(DEFINED CXX_BOGUS_FLAG)
+ # Verify that CHECK_C_COMPILER_FLAG didn't construct a normal variable
+ message(SEND_ERROR "CHECK_CXX_COMPILER_FLAG shouldn't construct CXX_BOGUS_FLAG as a normal variable")
+endif()
if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
unset(C_STRICT_PROTOTYPES CACHE)