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 <[email protected]>
---
 Modules/Platform/Darwin.cmake                             | 7 +++++++
 Tests/RunCMake/XcodeProject/RunCMakeTest.cmake            | 1 +
 Tests/RunCMake/XcodeProject/XcodePlatformFrameworks.cmake | 8 ++++++++
 3 files changed, 16 insertions(+)
 create mode 100644 Tests/RunCMake/XcodeProject/XcodePlatformFrameworks.cmake

diff --git a/Modules/Platform/Darwin.cmake b/Modules/Platform/Darwin.cmake
index e5c5f36..b912d98 100644
--- a/Modules/Platform/Darwin.cmake
+++ b/Modules/Platform/Darwin.cmake
@@ -166,6 +166,13 @@ if(_CMAKE_OSX_SYSROOT_PATH)
     ${_CMAKE_OSX_SYSROOT_PATH}/Network/Library/Frameworks
     ${_CMAKE_OSX_SYSROOT_PATH}/System/Library/Frameworks
     )
+  # add platform developer framework path if exists
+  get_filename_component(_CMAKE_OSX_PLATFORM_FRAMEWORK_PATH
+    ${_CMAKE_OSX_SYSROOT_PATH}/../../Library/Frameworks ABSOLUTE)
+  if(IS_DIRECTORY ${_CMAKE_OSX_PLATFORM_FRAMEWORK_PATH})
+    list(APPEND CMAKE_SYSTEM_FRAMEWORK_PATH
+      ${_CMAKE_OSX_PLATFORM_FRAMEWORK_PATH})
+  endif()
 endif()
 list(APPEND CMAKE_SYSTEM_FRAMEWORK_PATH
   /Library/Frameworks
diff --git a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake 
b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake
index 792f40e..e4773de 100644
--- a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake
+++ b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake
@@ -3,3 +3,4 @@ include(RunCMake)
 run_cmake(XcodeFileType)
 run_cmake(XcodeAttributeGenex)
 run_cmake(XcodeAttributeGenexError)
+run_cmake(XcodePlatformFrameworks)
diff --git a/Tests/RunCMake/XcodeProject/XcodePlatformFrameworks.cmake 
b/Tests/RunCMake/XcodeProject/XcodePlatformFrameworks.cmake
new file mode 100644
index 0000000..d34092a
--- /dev/null
+++ b/Tests/RunCMake/XcodeProject/XcodePlatformFrameworks.cmake
@@ -0,0 +1,8 @@
+enable_language(C)
+
+if(NOT XCODE_VERSION VERSION_LESS "5.0")
+  find_library(XCTEST_LIBRARY XCTest)
+  if(NOT XCTEST_LIBRARY)
+    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

Reply via email to