summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2009-09-17 19:33:12 (GMT)
committerBrad King <brad.king@kitware.com>2009-09-17 19:33:12 (GMT)
commit42857c747e2c8114f662958b297ec2d728b73ecb (patch)
tree1a6324f591b07d7fe27295e20019c5372e7c2347
parent7e3d437d0af7e625e19bbeac37e025d16cf8be11 (diff)
downloadCMake-42857c747e2c8114f662958b297ec2d728b73ecb.zip
CMake-42857c747e2c8114f662958b297ec2d728b73ecb.tar.gz
CMake-42857c747e2c8114f662958b297ec2d728b73ecb.tar.bz2
Test CHECK_(C|CXX)_COMPILER_FLAG macros
This teaches the TryCompile test to check that the compiler flag check macros correctly reject a bad flag. See issue #9516.
-rw-r--r--Tests/TryCompile/CMakeLists.txt10
1 files changed, 9 insertions, 1 deletions
diff --git a/Tests/TryCompile/CMakeLists.txt b/Tests/TryCompile/CMakeLists.txt
index 5925a87..ea571a2 100644
--- a/Tests/TryCompile/CMakeLists.txt
+++ b/Tests/TryCompile/CMakeLists.txt
@@ -200,4 +200,12 @@ TEST_ASSERT(CXX_BUILD_SHOULD_WORK "CHECK_CXX_SOURCE_COMPILES() failed")
TEST_FAIL(CXX_RUN_SHOULD_FAIL "CHECK_CXX_SOURCE_RUNS() succeeded, but should have failed")
TEST_ASSERT(CXX_RUN_SHOULD_WORK "CHECK_CXX_SOURCE_RUNS() failed")
-
+UNSET(C_BOGUS_FLAG CACHE)
+INCLUDE(CheckCCompilerFlag)
+CHECK_C_COMPILER_FLAG(-_this_is_not_a_flag_ C_BOGUS_FLAG)
+TEST_FAIL(C_BOGUS_FLAG "CHECK_C_COMPILER_FLAG() succeeded, but should have failed")
+
+UNSET(CXX_BOGUS_FLAG CACHE)
+INCLUDE(CheckCXXCompilerFlag)
+CHECK_CXX_COMPILER_FLAG(-_this_is_not_a_flag_ CXX_BOGUS_FLAG)
+TEST_FAIL(CXX_BOGUS_FLAG "CHECK_CXX_COMPILER_FLAG() succeeded, but should have failed")