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