diff options
author | Brad King <brad.king@kitware.com> | 2022-10-06 13:46:42 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2022-10-06 14:29:42 (GMT) |
commit | 90aa0bb30543cde2c3f58a090735904e17092c44 (patch) | |
tree | 8d19578f1df8747652e5ffcfe19ab57b7f5f5a1b /Tests/RunCMake/CheckCompilerFlag/CheckCXXCompilerFlag.cmake | |
parent | 64ac01451dad389bb4ca00019a38fbb8bd68308e (diff) | |
download | CMake-90aa0bb30543cde2c3f58a090735904e17092c44.zip CMake-90aa0bb30543cde2c3f58a090735904e17092c44.tar.gz CMake-90aa0bb30543cde2c3f58a090735904e17092c44.tar.bz2 |
Tests: Move TryCompile check module cases to RunCMake.Check*
The latter already have similar checks for similar modules.
Diffstat (limited to 'Tests/RunCMake/CheckCompilerFlag/CheckCXXCompilerFlag.cmake')
-rw-r--r-- | Tests/RunCMake/CheckCompilerFlag/CheckCXXCompilerFlag.cmake | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/Tests/RunCMake/CheckCompilerFlag/CheckCXXCompilerFlag.cmake b/Tests/RunCMake/CheckCompilerFlag/CheckCXXCompilerFlag.cmake new file mode 100644 index 0000000..eb20eb4 --- /dev/null +++ b/Tests/RunCMake/CheckCompilerFlag/CheckCXXCompilerFlag.cmake @@ -0,0 +1,19 @@ + +enable_language (CXX) +include(CheckCXXCompilerFlag) + +set(CXX 1) # test that this is tolerated + +if(NOT CMAKE_CXX_COMPILER_ID STREQUAL "PathScale") + set(DD --) +endif() + +check_cxx_compiler_flag("${DD}-_this_is_not_a_flag_" CXX_BOGUS_FLAG) +if(CXX_BOGUS_FLAG) + message(SEND_ERROR "CHECK_CXX_COMPILER_FLAG() succeeded, but should have failed") +endif() +unset(CXX_BOGUS_FLAG CACHE) +if(DEFINED CXX_BOGUS_FLAG) + # Verify that CHECK_CXX_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() |