CheckCompilerFlagSwift.cmake 530 B

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