diff options
author | Brad King <brad.king@kitware.com> | 2020-12-09 18:06:25 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2020-12-09 18:10:17 (GMT) |
commit | c404d7f221f170f01bc10247438bf1d011d8997a (patch) | |
tree | 5ab870ba67ae42396966c46f37bd330160ef5373 /Tests | |
parent | 8a3ecb484fb04aa9fb8b9f6d198b3a6942c26115 (diff) | |
download | CMake-c404d7f221f170f01bc10247438bf1d011d8997a.zip CMake-c404d7f221f170f01bc10247438bf1d011d8997a.tar.gz CMake-c404d7f221f170f01bc10247438bf1d011d8997a.tar.bz2 |
Tests: Add cache entry to control XCTest deployment target
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/CMakeLists.txt | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 4938681..8877115 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -1833,11 +1833,22 @@ if(BUILD_TESTING) ) endif() - if(CMake_TEST_XCODE_VERSION AND NOT CMake_TEST_XCODE_VERSION VERSION_LESS 5 - AND OSX_VERSION MATCHES "^([0-9]+\\.[0-9]+)") - set(XCTest_CTEST_OPTIONS --build-config $<CONFIGURATION>) - set(XCTest_BUILD_OPTIONS -DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_MATCH_1} -DCMAKE_OSX_SYSROOT=macosx) - ADD_TEST_MACRO(XCTest ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> -V) + if(CMake_TEST_XCODE_VERSION AND NOT CMake_TEST_XCODE_VERSION VERSION_LESS 5) + if(NOT CMake_TEST_XCTest_DEPLOYMENT_TARGET) + execute_process( + COMMAND sw_vers -productVersion + OUTPUT_VARIABLE OSX_VERSION + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + if(OSX_VERSION MATCHES "^([0-9]+\\.[0-9]+)") + set(CMake_TEST_XCTest_DEPLOYMENT_TARGET "${CMAKE_MATCH_1}") + endif() + endif() + if(CMake_TEST_XCTest_DEPLOYMENT_TARGET) + set(XCTest_CTEST_OPTIONS --build-config $<CONFIGURATION>) + set(XCTest_BUILD_OPTIONS -DCMAKE_OSX_DEPLOYMENT_TARGET=${CMake_TEST_XCTest_DEPLOYMENT_TARGET} -DCMAKE_OSX_SYSROOT=macosx) + ADD_TEST_MACRO(XCTest ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> -V) + endif() endif() add_test(linkorder1 ${CMAKE_CTEST_COMMAND} |