diff --git a/CMakeLists.txt b/CMakeLists.txt index a7a64fef18..288d669077 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -96,11 +96,16 @@ if (APPLE) set(CMAKE_OSX_DEPLOYMENT_TARGET 10.8) # find the 10.9 SDK path - execute_process(COMMAND xcodebuild -sdk -version OUTPUT_VARIABLE XCODE_SDK_VERSIONS) - string(REGEX MATCH \\/.+MacOSX10.9.sdk OSX_SDK_PATH ${XCODE_SDK_VERSIONS}) + find_path(_OSX_DESIRED_SDK_PATH NAME MacOSX10.9.sdk HINTS /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/ ${OSX_SDK_PATH}) + + if (NOT _OSX_DESIRED_SDK_PATH) + message(FATAL_ERROR "Could not find OS X 10.9 SDK. Please pass OSX_SDK_PATH to CMake to point us to your SDKs directory.") + else () + message(STATUS "Found OS X 10.9 SDK at ${_OSX_DESIRED_SDK_PATH}/MacOSX10.9.sdk") + endif () # set that as the SDK to use - set(CMAKE_OSX_SYSROOT ${OSX_SDK_PATH}) + set(CMAKE_OSX_SYSROOT ${_OSX_DESIRED_SDK_PATH}/MacOSX10.9.sdk) endif () # Find includes in corresponding build directories