summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2021-07-08 11:49:24 (GMT)
committerKitware Robot <kwrobot@kitware.com>2021-07-08 11:49:30 (GMT)
commitecd557cbd770e8d75a4cf4aaee523eefaf6f32af (patch)
tree0ab1ba2477286ca80fc10c5d8d1fc346637dca5c /Tests
parent709d0369e801d72a14d38d4dd8e88d5fdbbe0937 (diff)
parent018d300ca03c6ecea6b6b15d8c5caa7693eef84b (diff)
downloadCMake-ecd557cbd770e8d75a4cf4aaee523eefaf6f32af.zip
CMake-ecd557cbd770e8d75a4cf4aaee523eefaf6f32af.tar.gz
CMake-ecd557cbd770e8d75a4cf4aaee523eefaf6f32af.tar.bz2
Merge topic 'check_cxx_compiler_flag_no_normal_variable' into release-3.21
018d300ca0 Check*CompilerFlag: Do not set result as a normal variable too Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !6318
Diffstat (limited to 'Tests')
-rw-r--r--Tests/TryCompile/CMakeLists.txt10
1 files changed, 10 insertions, 0 deletions
diff --git a/Tests/TryCompile/CMakeLists.txt b/Tests/TryCompile/CMakeLists.txt
index fa0549f..d0c413f 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)