[cmake-developers] [PATCH v5 3/4] Also add Platform specific Frameworks to Darwin Framework search path
Gregor Jasny
gjasny at googlemail.com
Sun Feb 22 13:00:11 EST 2015
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 <gjasny at googlemail.com>
---
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
More information about the cmake-developers
mailing list