Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 16 additions & 14 deletions Modules/Platform/Darwin.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down
13 changes: 11 additions & 2 deletions Source/cmGlobalXCodeGenerator.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down