Ticket #44581: patch-Modules-Platform-Darwin.cmake.diff

File patch-Modules-Platform-Darwin.cmake.diff, 1.8 KB (added by jmroot (Joshua Root), 7 years ago)
  • Modules/Platform/Darwin.cmake

    old new  
    140140      else()
    141141        set(_CMAKE_OSX_SDKS_VER ${_CURRENT_OSX_VERSION}${_CMAKE_OSX_SDKS_VER_SUFFIX_${_CURRENT_OSX_VERSION}})
    142142        set(_CMAKE_OSX_SYSROOT_DEFAULT "${_CMAKE_OSX_SDKS_DIR}/MacOSX${_CMAKE_OSX_SDKS_VER}.sdk")
    143         message(WARNING
    144           "CMAKE_OSX_DEPLOYMENT_TARGET is '${CMAKE_OSX_DEPLOYMENT_TARGET}' "
    145           "but the matching SDK does not exist at:\n \"${_CMAKE_OSX_SYSROOT_CHECK}\"\n"
    146           "Instead using SDK:\n \"${_CMAKE_OSX_SYSROOT_DEFAULT}\"\n"
    147           "matching the host OS X version."
    148           )
     143        if(IS_DIRECTORY "${_CMAKE_OSX_SYSROOT_DEFAULT}")
     144          if (NOT "${CMAKE_OSX_DEPLOYMENT_TARGET}" STREQUAL "${_CURRENT_OSX_VERSION}")
     145            message(WARNING
     146              "CMAKE_OSX_DEPLOYMENT_TARGET is '${CMAKE_OSX_DEPLOYMENT_TARGET}' "
     147              "but the matching SDK does not exist at:\n \"${_CMAKE_OSX_SYSROOT_CHECK}\"\n"
     148              "Instead using SDK:\n \"${_CMAKE_OSX_SYSROOT_DEFAULT}\"\n"
     149              "matching the host OS X version."
     150              )
     151          endif()
     152        else ()
     153          set(_CMAKE_OSX_SYSROOT_DEFAULT "")
     154        endif()
    149155      endif()
    150156    else()
    151157      set(_CMAKE_OSX_SDKS_VER ${_CURRENT_OSX_VERSION}${_CMAKE_OSX_SDKS_VER_SUFFIX_${_CURRENT_OSX_VERSION}})
     
    207213    set(_sdk_ver "${CMAKE_MATCH_1}")
    208214  elseif("${_CMAKE_OSX_SYSROOT_ORIG}" MATCHES "^macosx([0-9]+\\.[0-9]+)$")
    209215    set(_sdk_ver "${CMAKE_MATCH_1}")
     216  elseif("${_CMAKE_OSX_SYSROOT_ORIG}" STREQUAL "/" OR "${_CMAKE_OSX_SYSROOT_ORIG}" STREQUAL "")
     217    set(_sdk_ver "${_CURRENT_OSX_VERSION}")
    210218  else()
    211219    message(FATAL_ERROR
    212220      "CMAKE_OSX_DEPLOYMENT_TARGET is '${CMAKE_OSX_DEPLOYMENT_TARGET}' "