Merge branch 'fix-macos-sysroot' into release

This commit is contained in:
Brad King 2016-11-02 08:44:16 -04:00
commit 503766fa0e
2 changed files with 2 additions and 30 deletions

View File

@ -113,7 +113,6 @@ set(CMAKE_OSX_SYSROOT "${_CMAKE_OSX_SYSROOT_DEFAULT}" CACHE ${_CMAKE_OSX_SYSROOT
"The product will be built against the headers and libraries located inside the indicated SDK.") "The product will be built against the headers and libraries located inside the indicated SDK.")
# Transform the cached value to something we can use. # Transform the cached value to something we can use.
set(_CMAKE_OSX_SYSROOT_ORIG "${CMAKE_OSX_SYSROOT}")
set(_CMAKE_OSX_SYSROOT_PATH "") set(_CMAKE_OSX_SYSROOT_PATH "")
if(CMAKE_OSX_SYSROOT) if(CMAKE_OSX_SYSROOT)
if("x${CMAKE_OSX_SYSROOT}" MATCHES "/") if("x${CMAKE_OSX_SYSROOT}" MATCHES "/")
@ -122,13 +121,10 @@ if(CMAKE_OSX_SYSROOT)
message(WARNING "Ignoring CMAKE_OSX_SYSROOT value:\n ${CMAKE_OSX_SYSROOT}\n" message(WARNING "Ignoring CMAKE_OSX_SYSROOT value:\n ${CMAKE_OSX_SYSROOT}\n"
"because the directory does not exist.") "because the directory does not exist.")
set(CMAKE_OSX_SYSROOT "") set(CMAKE_OSX_SYSROOT "")
set(_CMAKE_OSX_SYSROOT_ORIG "")
endif() endif()
set(_CMAKE_OSX_SYSROOT_PATH "${CMAKE_OSX_SYSROOT}") set(_CMAKE_OSX_SYSROOT_PATH "${CMAKE_OSX_SYSROOT}")
endif() else()
# 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

View File

@ -64,30 +64,6 @@ if(NOT DEFINED CMAKE_INSTALL_NAME_TOOL)
mark_as_advanced(CMAKE_INSTALL_NAME_TOOL) mark_as_advanced(CMAKE_INSTALL_NAME_TOOL)
endif() endif()
# Make sure the combination of SDK and Deployment Target are allowed
if(CMAKE_OSX_DEPLOYMENT_TARGET)
if("${_CMAKE_OSX_SYSROOT_PATH}" MATCHES "/MacOSX([0-9]+\\.[0-9]+)[^/]*\\.sdk")
set(_sdk_ver "${CMAKE_MATCH_1}")
elseif("${_CMAKE_OSX_SYSROOT_ORIG}" MATCHES "^macosx([0-9]+\\.[0-9]+)$")
set(_sdk_ver "${CMAKE_MATCH_1}")
elseif("${_CMAKE_OSX_SYSROOT_ORIG}" STREQUAL "/")
set(_sdk_ver "${_CURRENT_OSX_VERSION}")
else()
message(FATAL_ERROR
"CMAKE_OSX_DEPLOYMENT_TARGET is '${CMAKE_OSX_DEPLOYMENT_TARGET}' "
"but CMAKE_OSX_SYSROOT:\n \"${_CMAKE_OSX_SYSROOT_ORIG}\"\n"
"is not set to a MacOSX SDK with a recognized version. "
"Either set CMAKE_OSX_SYSROOT to a valid SDK or set "
"CMAKE_OSX_DEPLOYMENT_TARGET to empty.")
endif()
if(CMAKE_OSX_DEPLOYMENT_TARGET VERSION_GREATER "${_sdk_ver}")
message(FATAL_ERROR
"CMAKE_OSX_DEPLOYMENT_TARGET (${CMAKE_OSX_DEPLOYMENT_TARGET}) "
"is greater than CMAKE_OSX_SYSROOT SDK:\n ${_CMAKE_OSX_SYSROOT_ORIG}\n"
"Please set CMAKE_OSX_DEPLOYMENT_TARGET to ${_sdk_ver} or lower.")
endif()
endif()
# Enable shared library versioning. # Enable shared library versioning.
set(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-install_name") set(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-install_name")