3 include(CheckCompilerFlag)
5 set(CXX 1) # test that this is tolerated
7 # test that the check uses an isolated locale
8 set(_env_LC_ALL "${LC_ALL}")
11 check_compiler_flag(CXX "-_this_is_not_a_flag_" SHOULD_FAIL)
13 message(SEND_ERROR "invalid CXX compile flag didn't fail.")
16 if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|LCC|Clang" AND NOT "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC")
17 check_compiler_flag(CXX "-x c++" SHOULD_WORK)
19 message(SEND_ERROR "${CMAKE_CXX_COMPILER_ID} compiler flag '-x c++' check failed")
23 if(NOT "$ENV{LC_ALL}" STREQUAL "BAD")
24 message(SEND_ERROR "ENV{LC_ALL} was not preserved by check_compiler_flag")
26 set(ENV{LC_ALL} ${_env_LC_ALL})