Proposed fix to restore functionality for
-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING="" -DCMAKE_OSX_SYSROOT:STRING=/
while retaining the current hack when CMAKE_OSX_DEPLOYMENT_TARGET is
not set to an empty string.

On Sun, Oct 30, 2016 at 3:23 PM, Jack Howarth
<howarth.mailing.li...@gmail.com> wrote:
> Gregor,
>      While I still think your hack to obtain the versioned SDK is
> wrong because it relies on passing invalid arguments to 'xcodebuild
> -sdk', the following change restores the expected behavior for
> -DCMAKE_OSX_DEPLOYMENT_TARGET:STRING="" -DCMAKE_OSX_SYSROOT:STRING=/
> while allowing your hack to function when
> -DCMAKE_OSX_DEPLOYMENT_TARGET is not an empty string...
>
> --- cmake-3.7.0-rc2/Modules/Platform/Darwin-Initialize.cmake.orig
> 2016-10-30 09:45:46.000000000 -0400
> +++ cmake-3.7.0-rc2/Modules/Platform/Darwin-Initialize.cmake
> 2016-10-30 15:16:57.000000000 -0400
> @@ -116,7 +116,7 @@
>  set(_CMAKE_OSX_SYSROOT_ORIG "${CMAKE_OSX_SYSROOT}")
>  set(_CMAKE_OSX_SYSROOT_PATH "")
>  if(CMAKE_OSX_SYSROOT)
> -  if("x${CMAKE_OSX_SYSROOT}" MATCHES "/")
> +  if("x${CMAKE_OSX_SYSROOT}" MATCHES "/" AND
> CMAKE_OSX_DEPLOYMENT_TARGET MATCHES "")
>      # This is a path to the SDK.  Make sure it exists.
>      if(NOT IS_DIRECTORY "${CMAKE_OSX_SYSROOT}")
>        message(WARNING "Ignoring CMAKE_OSX_SYSROOT value:\n
> ${CMAKE_OSX_SYSROOT}\n"
> @@ -125,10 +125,8 @@
>        set(_CMAKE_OSX_SYSROOT_ORIG "")
>      endif()
>      set(_CMAKE_OSX_SYSROOT_PATH "${CMAKE_OSX_SYSROOT}")
> -  endif()
> -
> -  if(CMAKE_OSX_SYSROOT)
> -    # Transform the (maybe unversioned) sysroot into a versioned path.
> +  else()
> +    # Transform the sdk name into a path.
>      execute_process(
>        COMMAND xcodebuild -sdk ${CMAKE_OSX_SYSROOT} -version Path
>        OUTPUT_VARIABLE _stdout
>
>     Jack
>
> On Sun, Oct 30, 2016 at 2:53 PM, Jack Howarth
> <howarth.mailing.li...@gmail.com> wrote:
>> Gregor,
>>      The change in
>> https://cmake.org/gitweb?p=cmake.git;a=patch;h=540815eec2b83a8b43689580c54e8950d9f5868b
>> is logically flawed because it allows...
>>
>> COMMAND xcodebuild -sdk ${CMAKE_OSX_SYSROOT} -version Path
>>
>> to be passed ${CMAKE_OSX_SYSROOT} containing "/" which isn't a valid
>> argument for 'xcodebuild -sdk'...
>>
>> $ xcodebuild -sdk /
>> Build settings from command line:
>>     SDKROOT = macosx10.12
>>
>> This erroneously returns macosx10.12 despite the Xcode 7.3.1 Command
>> Line Tools being installed in / containing the 10.11 SDK files.
>>              Jack
>>
>>
>> On Sun, Oct 30, 2016 at 2:04 PM, Jack Howarth
>> <howarth.mailing.li...@gmail.com> wrote:
>>> Gregor,
>>>         This is also a severe regression because if forces the cmake
>>> users to build against the 10.12 SDK on 10.11 which is not well tested
>>> for backward compatibility on 10.11. Your change makes it impossible
>>> to build against the SDK in / installed by the Xcode Command Line
>>> Tools package.
>>>                Jack
>>>
>>> On Sun, Oct 30, 2016 at 1:33 PM, Jack Howarth
>>> <howarth.mailing.li...@gmail.com> wrote:
>>>> Gregor,
>>>>       Your commit of...
>>>>
>>>> https://cmake.org/gitweb?p=cmake.git;a=log;h=540815eec2b83a8b43689580c54e8950d9f5868b
>>>>
>>>> has caused a major regression in cmake 3.7.0 as it no longer properly
>>>> honors the combination...
>>>>
>>>> -DCMAKE_OSX_DEPLOYMENT_TARGET:STRING="" -DCMAKE_OSX_SYSROOT:STRING=/
>>>>
>>>> This is obvious by simple inspection of the code in
>>>> Modules/Platform/Darwin-Initialize.cmake as
>>>> the code no longer honors  -DCMAKE_OSX_SYSROOT:STRING=/. At the very
>>>> least, this code
>>>> needs to be modified to have cmake emit "-isysroot /" in that case.
>>>>        IMHO, this issue should be considered a blocker for the cmake
>>>> 3,7.0 release on darwin.
>>>>                       Jack
>>>>
>>>>
>>>> On Sun, Oct 30, 2016 at 9:36 AM, Jack Howarth
>>>> <howarth.mailing.li...@gmail.com> wrote:
>>>>> The change...
>>>>>
>>>>> --- cmake-3.6.2/Modules/Platform/Darwin-Initialize.cmake 2016-09-07
>>>>> 10:11:58.000000000 -0400
>>>>> +++ cmake-3.7.0-rc2/Modules/Platform/Darwin-Initialize.cmake
>>>>> 2016-10-19 09:47:45.000000000 -0400
>>>>> @@ -125,8 +125,10 @@
>>>>>        set(_CMAKE_OSX_SYSROOT_ORIG "")
>>>>>      endif()
>>>>>      set(_CMAKE_OSX_SYSROOT_PATH "${CMAKE_OSX_SYSROOT}")
>>>>> -  else()
>>>>> -    # Transform the sdk name into a path.
>>>>> +  endif()
>>>>> +
>>>>> +  if(CMAKE_OSX_SYSROOT)
>>>>> +    # Transform the (maybe unversioned) sysroot into a versioned path.
>>>>>      execute_process(
>>>>>        COMMAND xcodebuild -sdk ${CMAKE_OSX_SYSROOT} -version Path
>>>>>        OUTPUT_VARIABLE _stdout
>>>>>
>>>>> is an obvious mistake in cmake 3.7.0-rc2. The removal of the 'else()'
>>>>> statement here and the substitution of the ' if(CMAKE_OSX_SYSROOT)'
>>>>> defeats the prior handling of 'if("x${CMAKE_OSX_SYSROOT}" MATCHES
>>>>> "/")'. This causes '-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=""
>>>>> -DCMAKE_OSX_SYSROOT:STRING=/' to not be honored and -isysroot to be
>>>>> emitted as a compiler flag universally.
>>>>>
>>>>> https://gitlab.kitware.com/cmake/cmake/issues/16394

Attachment: cmake.patch
Description: Binary data

-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers

Reply via email to