summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorDavid Cole <david.cole@kitware.com>2012-03-03 20:03:50 (GMT)
committerDavid Cole <david.cole@kitware.com>2012-03-09 03:43:19 (GMT)
commit4693cf84927850da0c10aae4308363fdc5890379 (patch)
tree65a9cb43a0bb4b446fc233413c7e9494b914c9df /Modules
parentac2979e4b36577e10b2180624050e600179a53da (diff)
downloadCMake-4693cf84927850da0c10aae4308363fdc5890379.zip
CMake-4693cf84927850da0c10aae4308363fdc5890379.tar.gz
CMake-4693cf84927850da0c10aae4308363fdc5890379.tar.bz2
Xcode: Detect new default locations of Xcode 4.3 bits and pieces (#12621)
Xcode 4.3 installs into "/Applications" by default, from the Mac App Store. Also, the paths to the available SDKs changed: they are now within the Xcode.app bundle. PackageMaker is installed as a separate program, and may be installed anywhere. It is not installed with Xcode 4.3 by default anymore. Download the "Auxiliary Tools for Xcode" to get PackageMaker. Put PackageMaker inside the Xcode.app bundle, in its nested Applications folder, or put it alongside Xcode in "/Applications" and CMake will find it. Update references to "find" paths: add new possible locations for finding Xcode.app and PackageMaker.app. Prefer the most recent version's locations first, but keep the old locations as fallback search paths, too. Thanks to all the contributors who provided and tested out various patches for fixing this issue. Especially, but by no means limited to: Francisco Requena EspĂ­, Jamie Kirkpatrick and drfrogsplat.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/Platform/Darwin.cmake33
1 files changed, 20 insertions, 13 deletions
diff --git a/Modules/Platform/Darwin.cmake b/Modules/Platform/Darwin.cmake
index 867c788..c4b5635 100644
--- a/Modules/Platform/Darwin.cmake
+++ b/Modules/Platform/Darwin.cmake
@@ -6,6 +6,8 @@ SET(APPLE 1)
# 8.x == Mac OSX 10.4 (Tiger)
# 9.x == Mac OSX 10.5 (Leopard)
# 10.x == Mac OSX 10.6 (Snow Leopard)
+# 11.x == Mac OSX 10.7 (Lion)
+# 12.x == Mac OSX 10.8 (Mountain Lion)
STRING(REGEX REPLACE "^([0-9]+)\\.([0-9]+).*$" "\\1" DARWIN_MAJOR_VERSION "${CMAKE_SYSTEM_VERSION}")
STRING(REGEX REPLACE "^([0-9]+)\\.([0-9]+).*$" "\\2" DARWIN_MINOR_VERSION "${CMAKE_SYSTEM_VERSION}")
@@ -59,19 +61,24 @@ 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/*")
+# Start with Xcode-4.3+ default SDKs directory
+SET(_CMAKE_OSX_SDKS_DIR
+ "${OSX_DEVELOPER_ROOT}/Platforms/MacOSX.platform/Developer/SDKs")
+FILE(GLOB _CMAKE_OSX_SDKS "${_CMAKE_OSX_SDKS_DIR}/*")
-# If nothing is found there, then try locating the dev tools based on the xcode-select tool
-# (available in Xcode >= 3.0 installations)
+# If not present, try pre-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}/SDKs")
+ FILE(GLOB _CMAKE_OSX_SDKS "${_CMAKE_OSX_SDKS_DIR}/*")
ENDIF(NOT _CMAKE_OSX_SDKS)
EXECUTE_PROCESS(COMMAND sw_vers -productVersion
@@ -103,16 +110,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: