diff options
author | Brad King <brad.king@kitware.com> | 2023-03-14 13:28:43 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2023-03-14 13:29:01 (GMT) |
commit | c77801029d42f403648654eca8dbe3634240271f (patch) | |
tree | d2378c4c1a8c6d4a53ea2547c22492a12091e46d /Tests | |
parent | 614cf24aaedb8813638c66709acda0329ff2a76e (diff) | |
parent | 97fcd3bd300b19d6ee4b2682fd7c5630c6a1e814 (diff) | |
download | CMake-c77801029d42f403648654eca8dbe3634240271f.zip CMake-c77801029d42f403648654eca8dbe3634240271f.tar.gz CMake-c77801029d42f403648654eca8dbe3634240271f.tar.bz2 |
Merge topic 'revert-CheckCompilerFlag-clang-argument-unused'
97fcd3bd30 CheckCompilerFlag: Revert 'Match the Clang "argument unused" output ...'
Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Acked-by: scivision <michael@scivision.dev>
Merge-request: !8322
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/RunCMake/CheckCompilerFlag/CheckCompilerFlagC.cmake | 9 | ||||
-rw-r--r-- | Tests/RunCMake/CheckCompilerFlag/CheckCompilerFlagCXX.cmake | 9 |
2 files changed, 18 insertions, 0 deletions
diff --git a/Tests/RunCMake/CheckCompilerFlag/CheckCompilerFlagC.cmake b/Tests/RunCMake/CheckCompilerFlag/CheckCompilerFlagC.cmake index 276158c..64a961e 100644 --- a/Tests/RunCMake/CheckCompilerFlag/CheckCompilerFlagC.cmake +++ b/Tests/RunCMake/CheckCompilerFlag/CheckCompilerFlagC.cmake @@ -18,6 +18,15 @@ if(CMAKE_C_COMPILER_ID MATCHES "GNU|LCC|Clang" AND NOT "x${CMAKE_C_SIMULATE_ID}" if(NOT SHOULD_WORK) message(SEND_ERROR "${CMAKE_C_COMPILER_ID} compiler flag '-x c' check failed") endif() + + block() + # Test tolerating a flag that is not used when driving the linker. + string(APPEND CMAKE_C_FLAGS " -nostdinc") + check_compiler_flag(C "-x c" SHOULD_WORK_NOSTDINC) + if(NOT SHOULD_WORK_NOSTDINC) + message(SEND_ERROR "${CMAKE_C_COMPILER_ID} compiler flag '-x c -nostdinc' check failed") + endif() + endblock() endif() if(CMAKE_C_COMPILER_ID STREQUAL "GNU") # LCC C compiler silently ignore -frtti instead of failing, so skip it here. diff --git a/Tests/RunCMake/CheckCompilerFlag/CheckCompilerFlagCXX.cmake b/Tests/RunCMake/CheckCompilerFlag/CheckCompilerFlagCXX.cmake index dec31ec..0026a2a 100644 --- a/Tests/RunCMake/CheckCompilerFlag/CheckCompilerFlagCXX.cmake +++ b/Tests/RunCMake/CheckCompilerFlag/CheckCompilerFlagCXX.cmake @@ -18,6 +18,15 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|LCC|Clang" AND NOT "x${CMAKE_CXX_SIMULATE_ if(NOT SHOULD_WORK) message(SEND_ERROR "${CMAKE_CXX_COMPILER_ID} compiler flag '-x c++' check failed") endif() + + block() + # Test tolerating a flag that is not used when driving the linker. + string(APPEND CMAKE_CXX_FLAGS " -nostdinc++") + check_compiler_flag(CXX "-x c++" SHOULD_WORK_NOSTDINCXX) + if(NOT SHOULD_WORK_NOSTDINCXX) + message(SEND_ERROR "${CMAKE_CXX_COMPILER_ID} compiler flag '-x c++ -nostdinc++' check failed") + endif() + endblock() endif() if(NOT "$ENV{LC_ALL}" STREQUAL "BAD") |