mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-01 11:22:21 -06:00
Plumb through swift `check_source_compiles` support. Add tests to check that valid swift sources compile and invalid sources don't.
16 lines
387 B
CMake
16 lines
387 B
CMake
enable_language(Swift)
|
|
include(CheckSourceCompiles)
|
|
|
|
set(Swift 1) # test that this is tolerated
|
|
|
|
check_source_compiles(Swift "baz()" SHOULD_FAIL)
|
|
|
|
if(SHOULD_FAIL)
|
|
message(SEND_ERROR "invalid Swift source didn't fail.")
|
|
endif()
|
|
|
|
check_source_compiles(Swift "print(\"Hello, CMake\")" SHOULD_BUILD)
|
|
if(NOT SHOULD_BUILD)
|
|
message(SEND_ERROR "Test failed for valid Swift source.")
|
|
endif()
|