Debian Codegraph @

Tests/RunCMake/CheckCompilerFlag/CheckCompilerFlagSwift.cmake

raw
1 cmake_policy(SET CMP0157 NEW)
2 enable_language (Swift)
3 include(CheckCompilerFlag)
4
5 set(Swift 1)
6
7 # test that the check uses an isolated locale
8 set(_env_LC_ALL "${LC_ALL}")
9 set(ENV{LC_ALL} "BAD")
10
11 check_compiler_flag(Swift "-foo-as-blarpy" SHOULD_FAIL)
12 if(SHOULD_FAIL)
13 message(SEND_ERROR "invalid Swift compile flag didn't fail.")
14 endif()
15
16 check_compiler_flag(Swift "-Onone" SHOULD_WORK)
17 if(NOT SHOULD_WORK)
18 message(SEND_ERROR "Swift compiler flag '-Onone' check failed")
19 endif()
20
21 # Reset locale
22 set(ENV{LC_ALL} ${_env_LC_ALL})