From 4451a1f54fd2c1ba6aed4c38c23cb45e09f6be1d Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 21 Oct 2022 10:37:48 -0400 Subject: Tests: Factor out a CMake_TEST_Swift variable for Swift test conditions --- Tests/CMakeLists.txt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 04db70b..6ca08d0 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -343,6 +343,11 @@ if(BUILD_TESTING) endif() endif() endif() + if(NOT DEFINED CMake_TEST_Swift) + if(CMAKE_Swift_COMPILER OR CMake_TEST_XCODE_SWIFT) + set(CMake_TEST_Swift 1) + endif() + endif() # Use 1500 or CTEST_TEST_TIMEOUT for long test timeout value, # whichever is greater. @@ -390,7 +395,7 @@ if(BUILD_TESTING) ADD_TEST_MACRO(MissingSourceFile MissingSourceFile) set_tests_properties(MissingSourceFile PROPERTIES PASS_REGULAR_EXPRESSION "CMake Error at CMakeLists.txt:3 \\(add_executable\\):[ \r\n]*Cannot find source file:[ \r\n]*DoesNotExist/MissingSourceFile.c") - if(CMAKE_Swift_COMPILER OR CMake_TEST_XCODE_SWIFT) + if(CMake_TEST_Swift) ADD_TEST_MACRO(SwiftOnly SwiftOnly) if(CMake_TEST_XCODE_SWIFT) ADD_TEST_MACRO(SwiftMix SwiftMix) -- cgit v0.12