Xcode: Convert maybe unversioned OSX sysroot into versioned SDK path
Starting with Xcode 8 the SDK folder also contains an unversioned entry: $ ls -l /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs drwxr-xr-x 5 root wheel 170 Mar 4 2018 MacOSX.sdk lrwxr-xr-x 1 root wheel 10 Sep 16 20:49 MacOSX10.12.sdk -> MacOSX.sdk If this unversioned path is used CMake cannot detect the SDK version. To work around the problem we always invoke the code path that translates short SDK names like "macosx10.12" into a path. That way we always end up with a versioned SDK path in _CMAKE_OSX_SYSROOT_PATH which is later used to determine the version. Closes: #16323
This commit is contained in:
parent
02277aef10
commit
540815eec2
|
@ -125,8 +125,10 @@ if(CMAKE_OSX_SYSROOT)
|
||||||
set(_CMAKE_OSX_SYSROOT_ORIG "")
|
set(_CMAKE_OSX_SYSROOT_ORIG "")
|
||||||
endif()
|
endif()
|
||||||
set(_CMAKE_OSX_SYSROOT_PATH "${CMAKE_OSX_SYSROOT}")
|
set(_CMAKE_OSX_SYSROOT_PATH "${CMAKE_OSX_SYSROOT}")
|
||||||
else()
|
endif()
|
||||||
# Transform the sdk name into a path.
|
|
||||||
|
if(CMAKE_OSX_SYSROOT)
|
||||||
|
# Transform the (maybe unversioned) sysroot into a versioned path.
|
||||||
execute_process(
|
execute_process(
|
||||||
COMMAND xcodebuild -sdk ${CMAKE_OSX_SYSROOT} -version Path
|
COMMAND xcodebuild -sdk ${CMAKE_OSX_SYSROOT} -version Path
|
||||||
OUTPUT_VARIABLE _stdout
|
OUTPUT_VARIABLE _stdout
|
||||||
|
|
Loading…
Reference in New Issue