diff options
author | Jens Verwiebe <info@jensverwiebe.de> | 2013-09-13 18:57:57 +0400 |
---|---|---|
committer | Jens Verwiebe <info@jensverwiebe.de> | 2013-09-13 18:57:57 +0400 |
commit | e59bc04aa71792b07ae7004e26e706c92384a7de (patch) | |
tree | 27a4448c9f6482bebf77979bb4fd5a0f35463a10 /CMakeLists.txt | |
parent | 5d546784774110ab0ace9f79f42f2a2980fd592c (diff) |
OSX/cmake: allow for compiling with xcode develper previews by determing xcode-select
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index caaf913f163..2df66055015 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -323,6 +323,16 @@ if(APPLE) if(${CMAKE_GENERATOR} MATCHES "Xcode") + # workaround for incorrect cmake xcode lookup for developer previews - XCODE_VERSION does not take xcode-select path into accout + # but would always look into /Applications/Xcode.app while dev versions are named Xcode<version>-DP<preview_number> + execute_process(COMMAND xcode-select --print-path OUTPUT_VARIABLE XCODE_CHECK OUTPUT_STRIP_TRAILING_WHITESPACE) + string(REPLACE "/Contents/Developer" "" XCODE_BUNDLE ${XCODE_CHECK}) # truncate to bundlepath in any case + message(STATUS "Xcode-bundle : " ${XCODE_BUNDLE}) + string(SUBSTRING "${XCODE_CHECK}" 14 6 DP_NAME) # reduce to XCode name without dp extension + if(${DP_NAME} MATCHES Xcode5) + set(XCODE_VERSION 5) + endif() + ##### cmake incompatibility with xcode 4.3 and higher ##### if(${XCODE_VERSION} MATCHES '') # cmake fails due looking for xcode in the wrong path, thus will be empty var message(FATAL_ERROR "Xcode 4.3 and higher must be used with cmake 2.8-8 or higher") @@ -346,9 +356,10 @@ if(APPLE) if(${XCODE_VERSION} VERSION_LESS 4.3) set(CMAKE_OSX_SYSROOT /Developer/SDKs/MacOSX${OSX_SYSTEM}.sdk CACHE PATH "" FORCE) # use guaranteed existing sdk else() - # note: i don't use xcode-select path on purpose, cause also /Applications/Xcode.app would be allowed - # absolute pathes are more foolproof here ! - set(OSX_SYSROOT_PREFIX /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform) + # note: xcode-select path could be ambigous, cause /Applications/Xcode.app/Contents/Developer or /Applications/Xcode.app would be allowed + # so i use a selfcomposed bundlepath here + set(OSX_SYSROOT_PREFIX ${XCODE_BUNDLE}/Contents/Developer/Platforms/MacOSX.platform) + message(STATUS "OSX_SYSROOT_PREFIX: " ${OSX_SYSROOT_PREFIX}) set(OSX_DEVELOPER_PREFIX /Developer/SDKs/MacOSX${OSX_SYSTEM}.sdk) # use guaranteed existing sdk set(CMAKE_OSX_SYSROOT ${OSX_SYSROOT_PREFIX}/${OSX_DEVELOPER_PREFIX} CACHE PATH "" FORCE) endif() |