Created
March 2, 2012 14:02
-
-
Save bpiwowar/1958550 to your computer and use it in GitHub Desktop.
Patch for cmake (2.8.7) for Xcode 4.3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git Modules/Platform/Darwin.cmake Modules/Platform/Darwin.cmake | |
index 867c788..0e17b80 100644 | |
--- Modules/Platform/Darwin.cmake | |
+++ Modules/Platform/Darwin.cmake | |
@@ -58,20 +58,22 @@ ENDIF(NOT DEFINED CMAKE_INSTALL_NAME_TOOL) | |
# Set the assumed (Pre 10.5 or Default) location of the developer tools | |
SET(OSX_DEVELOPER_ROOT "/Developer") | |
+# Use the xcode-select tool if it's available (Xcode >= 3.0 installations) | |
+FIND_PROGRAM(CMAKE_XCODE_SELECT xcode-select) | |
+IF(CMAKE_XCODE_SELECT) | |
+ EXECUTE_PROCESS(COMMAND ${CMAKE_XCODE_SELECT} "-print-path" | |
+ OUTPUT_VARIABLE OSX_DEVELOPER_ROOT | |
+ OUTPUT_STRIP_TRAILING_WHITESPACE) | |
+ENDIF(CMAKE_XCODE_SELECT) | |
# Find installed SDKs | |
-FILE(GLOB _CMAKE_OSX_SDKS "${OSX_DEVELOPER_ROOT}/SDKs/*") | |
- | |
-# If nothing is found there, then try locating the dev tools based on the xcode-select tool | |
-# (available in Xcode >= 3.0 installations) | |
+# Start with pre-Xcode-4.3 default SDKs directory | |
+SET(_CMAKE_OSX_SDKS_DIR "${OSX_DEVELOPER_ROOT}/SDKs") | |
+FILE(GLOB _CMAKE_OSX_SDKS "${_CMAKE_OSX_SDKS_DIR}/*") | |
+# If not present, try 4.3+ SDKs directory | |
IF(NOT _CMAKE_OSX_SDKS) | |
- FIND_PROGRAM(CMAKE_XCODE_SELECT xcode-select) | |
- IF(CMAKE_XCODE_SELECT) | |
- EXECUTE_PROCESS(COMMAND ${CMAKE_XCODE_SELECT} "-print-path" | |
- OUTPUT_VARIABLE OSX_DEVELOPER_ROOT | |
- OUTPUT_STRIP_TRAILING_WHITESPACE) | |
- FILE(GLOB _CMAKE_OSX_SDKS "${OSX_DEVELOPER_ROOT}/SDKs/*") | |
- ENDIF(CMAKE_XCODE_SELECT) | |
+ SET(_CMAKE_OSX_SDKS_DIR "${OSX_DEVELOPER_ROOT}/Platforms/MacOSX.platform/Developer/SDKs") | |
+ FILE(GLOB _CMAKE_OSX_SDKS "${_CMAKE_OSX_SDKS_DIR}/*") | |
ENDIF(NOT _CMAKE_OSX_SDKS) | |
EXECUTE_PROCESS(COMMAND sw_vers -productVersion | |
@@ -103,16 +105,16 @@ SET(ENV_SDKROOT "$ENV{SDKROOT}") | |
# Set CMAKE_OSX_SYSROOT_DEFAULT based on _CURRENT_OSX_VERSION, | |
# accounting for the known specially named SDKs. | |
SET(CMAKE_OSX_SYSROOT_DEFAULT | |
- "${OSX_DEVELOPER_ROOT}/SDKs/MacOSX${_CURRENT_OSX_VERSION}.sdk") | |
+ "${_CMAKE_OSX_SDKS_DIR}/MacOSX${_CURRENT_OSX_VERSION}.sdk") | |
IF(_CURRENT_OSX_VERSION STREQUAL "10.4") | |
SET(CMAKE_OSX_SYSROOT_DEFAULT | |
- "${OSX_DEVELOPER_ROOT}/SDKs/MacOSX10.4u.sdk") | |
+ "${_CMAKE_OSX_SDKS_DIR}/MacOSX10.4u.sdk") | |
ENDIF(_CURRENT_OSX_VERSION STREQUAL "10.4") | |
IF(_CURRENT_OSX_VERSION STREQUAL "10.3") | |
SET(CMAKE_OSX_SYSROOT_DEFAULT | |
- "${OSX_DEVELOPER_ROOT}/SDKs/MacOSX10.3.9.sdk") | |
+ "${_CMAKE_OSX_SDKS_DIR}/MacOSX10.3.9.sdk") | |
ENDIF(_CURRENT_OSX_VERSION STREQUAL "10.3") | |
# Use environment or default as initial cache value: | |
diff --git Source/cmGlobalXCodeGenerator.cxx Source/cmGlobalXCodeGenerator.cxx | |
index 859503f..6574500 100644 | |
--- Source/cmGlobalXCodeGenerator.cxx | |
+++ Source/cmGlobalXCodeGenerator.cxx | |
@@ -135,8 +135,17 @@ cmGlobalGenerator* cmGlobalXCodeGenerator::New() | |
{ | |
#if defined(CMAKE_BUILD_WITH_CMAKE) | |
cmXcodeVersionParser parser; | |
- parser.ParseFile | |
- ("/Developer/Applications/Xcode.app/Contents/version.plist"); | |
+ if (cmSystemTools::FileExists("/Applications/Xcode.app/Contents/version.plist")) | |
+ { | |
+ parser.ParseFile | |
+ ("/Applications/Xcode.app/Contents/version.plist"); | |
+ } | |
+ else | |
+ { | |
+ parser.ParseFile | |
+ ("/Developer/Applications/Xcode.app/Contents/version.plist"); | |
+ | |
+ } | |
cmsys::auto_ptr<cmGlobalXCodeGenerator> | |
gg(new cmGlobalXCodeGenerator(parser.Version)); | |
if (gg->XcodeVersion == 20) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
From http://public.kitware.com/Bug/view.php?id=12621
and
https://github.com/Kitware/CMake/pull/15/files