Otherwise find_library is unable to lookup the XCTest framework which is not located in the SDK serach path:
In the 10.10 SDK the SDK frameworks are located here: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/ Developer/SDKs/MacOSX10.10.sdk/System/Library/Frameworks/ whereas the Platform SDKs are located here: Developer/Library/Frameworks Signed-off-by: Gregor Jasny <gja...@googlemail.com> --- Modules/Platform/Darwin.cmake | 5 ++++ Tests/XcodePlatformFrameworks/CMakeLists.txt | 38 ++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 Tests/XcodePlatformFrameworks/CMakeLists.txt diff --git a/Modules/Platform/Darwin.cmake b/Modules/Platform/Darwin.cmake index e5c5f36..e3d705d 100644 --- a/Modules/Platform/Darwin.cmake +++ b/Modules/Platform/Darwin.cmake @@ -166,6 +166,11 @@ if(_CMAKE_OSX_SYSROOT_PATH) ${_CMAKE_OSX_SYSROOT_PATH}/Network/Library/Frameworks ${_CMAKE_OSX_SYSROOT_PATH}/System/Library/Frameworks ) + if(IS_DIRECTORY ${_CMAKE_OSX_SYSROOT_PATH}/../../Library/Frameworks) + list(APPEND CMAKE_SYSTEM_FRAMEWORK_PATH + ${_CMAKE_OSX_SYSROOT_PATH}/../../Library/Frameworks + ) + endif() endif() list(APPEND CMAKE_SYSTEM_FRAMEWORK_PATH /Library/Frameworks diff --git a/Tests/XcodePlatformFrameworks/CMakeLists.txt b/Tests/XcodePlatformFrameworks/CMakeLists.txt new file mode 100644 index 0000000..09e374a --- /dev/null +++ b/Tests/XcodePlatformFrameworks/CMakeLists.txt @@ -0,0 +1,38 @@ +cmake_minimum_required(VERSION 3.1) + +set(CMAKE_OSX_SYSROOT macosx) + +project(XcodePlatformFrameworks) + +# detect Xcode version + +execute_process( + COMMAND xcodebuild -version + OUTPUT_VARIABLE _stdout + OUTPUT_STRIP_TRAILING_WHITESPACE + ERROR_VARIABLE _stderr + RESULT_VARIABLE _failed + ) + +if(_failed) + message(FATAL_ERROR "Error while running xcodebuild: ${_stderr}") +endif() + +set(XCODE_VERSION_REGEX ".*Xcode +([0-9.]+).*") + +if(NOT _stdout MATCHES ${XCODE_VERSION_REGEX}) + message(FATAL_ERROR "Cannot find Xcode version in ${_stdout}") +endif() + +string(REGEX REPLACE "${XCODE_VERSION_REGEX}" "\\1" XCODE_VERSION ${_stdout}) + +message(STATUS "Xcode version: ${XCODE_VERSION}") + +if(NOT XCODE_VERSION VERSION_LESS "5.0") + find_library(XCTEST_LIBRARY XCTest) + if(XCTEST_LIBRARY) + message(STATUS "XCTest found: ${XCTEST_LIBRARY}") + else() + message(FATAL_ERROR "XCTest Framework not found.") + endif() +endif() -- 2.3.0 -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake-developers