diff options
Diffstat (limited to 'Tests/RunCMake/CheckSourceCompiles/CheckSourceCompilesSwift.cmake')
-rw-r--r-- | Tests/RunCMake/CheckSourceCompiles/CheckSourceCompilesSwift.cmake | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/Tests/RunCMake/CheckSourceCompiles/CheckSourceCompilesSwift.cmake b/Tests/RunCMake/CheckSourceCompiles/CheckSourceCompilesSwift.cmake new file mode 100644 index 0000000..767fa69 --- /dev/null +++ b/Tests/RunCMake/CheckSourceCompiles/CheckSourceCompilesSwift.cmake @@ -0,0 +1,15 @@ +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() |