diff options
author | Brad King <brad.king@kitware.com> | 2021-07-08 11:49:24 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2021-07-08 11:49:31 (GMT) |
commit | c19b10883edfd280f0d7f809d2c4153b9111889e (patch) | |
tree | 43752c41aedfb561a23f23ccbafd7f3682765e84 /Tests/TryCompile | |
parent | 33d6ba668f2977fb5fcb038df2b31df7446fd678 (diff) | |
parent | 018d300ca03c6ecea6b6b15d8c5caa7693eef84b (diff) | |
download | CMake-c19b10883edfd280f0d7f809d2c4153b9111889e.zip CMake-c19b10883edfd280f0d7f809d2c4153b9111889e.tar.gz CMake-c19b10883edfd280f0d7f809d2c4153b9111889e.tar.bz2 |
Merge topic 'check_cxx_compiler_flag_no_normal_variable'
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/TryCompile')
-rw-r--r-- | Tests/TryCompile/CMakeLists.txt | 10 |
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) |