diff options
author | Brad King <brad.king@kitware.com> | 2019-05-14 14:48:04 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2019-05-14 14:48:13 (GMT) |
commit | 7d9db24f4c1eb68687bf66002577781d01684478 (patch) | |
tree | c2fd47f074eaeee7a3570ef16b311c7d06623f21 /Modules | |
parent | 9d48d3f61b25400a191f12ea92b8e5496ab47a8f (diff) | |
parent | e9d128b789f91c3f8d22e366500f58e6c7f6abc6 (diff) | |
download | CMake-7d9db24f4c1eb68687bf66002577781d01684478.zip CMake-7d9db24f4c1eb68687bf66002577781d01684478.tar.gz CMake-7d9db24f4c1eb68687bf66002577781d01684478.tar.bz2 |
Merge topic 'ios-xctest-lookup'
e9d128b789 Apple: Properly lookup XCTest for iOS and tvOS
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3309
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/FindXCTest.cmake | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/Modules/FindXCTest.cmake b/Modules/FindXCTest.cmake index 8497336..15721e1 100644 --- a/Modules/FindXCTest.cmake +++ b/Modules/FindXCTest.cmake @@ -61,6 +61,22 @@ The following variables are set by including this module: #]=======================================================================] +set(_PRESERVED_CMAKE_FIND_ROOT_PATH "${CMAKE_FIND_ROOT_PATH}") + +if(CMAKE_EFFECTIVE_SYSTEM_NAME STREQUAL "Apple" + AND NOT CMAKE_SYSTEM_NAME STREQUAL "Darwin") + # Non-macos systems set the CMAKE_FIND_ROOT_PATH_MODE to "ONLY" which + # restricts the search paths too much to find XCTest.framework. In + # contrast to the regular system frameworks which reside within the + # SDK direectory the XCTest framework is located in the respective + # platform directory which is not added to the CMAKE_FIND_ROOT_PATH + # (only to CMAKE_SYSTEM_FRAMEWORK_PATH) and therefore not searched. + # + # Until this is properly addressed, temporaily add the platform + # directory to CMAKE_FIND_ROOT_PATH. + list(APPEND CMAKE_FIND_ROOT_PATH "${_CMAKE_OSX_SYSROOT_PATH}/../..") +endif() + find_path(XCTest_INCLUDE_DIR NAMES "XCTest/XCTest.h" DOC "XCTest include directory") @@ -71,6 +87,9 @@ find_library(XCTest_LIBRARY DOC "XCTest Framework library") mark_as_advanced(XCTest_LIBRARY) +set(CMAKE_FIND_ROOT_PATH "${_PRESERVED_CMAKE_FIND_ROOT_PATH}") +unset(_PRESERVED_CMAKE_FIND_ROOT_PATH) + execute_process( COMMAND xcrun --find xctest OUTPUT_VARIABLE _xcrun_out OUTPUT_STRIP_TRAILING_WHITESPACE |