cmake/Tests/RunCMake/CheckCompilerFlag/CheckCompilerFlagSwift.cmake

23 lines
530 B
CMake
Raw Normal View History

2024-04-14 22:45:38 +02:00
cmake_policy(SET CMP0157 NEW)
2023-05-23 16:38:00 +02:00
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()
2024-04-14 22:45:38 +02:00
check_compiler_flag(Swift "-Onone" SHOULD_WORK)
2023-05-23 16:38:00 +02:00
if(NOT SHOULD_WORK)
2024-04-14 22:45:38 +02:00
message(SEND_ERROR "Swift compiler flag '-Onone' check failed")
2023-05-23 16:38:00 +02:00
endif()
# Reset locale
set(ENV{LC_ALL} ${_env_LC_ALL})