Computation of CMAKE_OSX_SYSROOT

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Computation of CMAKE_OSX_SYSROOT

CMake mailing list
Hi,

The docs here:

        https://cmake.org/cmake/help/v3.12/variable/CMAKE_OSX_SYSROOT.html

state that CMAKE_OSX_SYSROOT is computed from CMAKE_OSX_DEPLOYMENT_TARGET if not explicitly set. Can anyone comment on how this works, because in my setup it seems to be failing. This showed up as -isysroot not being passed to the compiler, which then causes weird compile failures building on High Sierra with Xcode 10 and the 10.14 SDK.

If explicitly set SDKROOT or CMAKE_OSX_SYSROOT to the 10.14 SDK, everything compiles fine. (Without passing -isysroot, some header is /usr/include are used, and apparently these don’t work for building the 10.14 frameworks)

Deployment target is set to:

        set(CMAKE_OSX_DEPLOYMENT_TARGET "10.7”)

Note that I do this *after* calling project() because contrary to its docs, I find that when I call it before project(), it has no effect. (eg, passing -mmacosx-version-min=10.7 to the compiler).

Full CMakeList.txt is here:

        https://sourceforge.net/p/flightgear/flightgear/ci/next/tree/CMakeLists.txt

Any comments on what is going on, would be appreciated.

Kind regards,
James


--

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:
https://cmake.org/mailman/listinfo/cmake

smime.p7s (5K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Computation of CMAKE_OSX_SYSROOT

Craig Scott-3


On Mon, Oct 1, 2018 at 10:53 PM James Turner via CMake <[hidden email]> wrote:
Hi,

The docs here:

        https://cmake.org/cmake/help/v3.12/variable/CMAKE_OSX_SYSROOT.html

state that CMAKE_OSX_SYSROOT is computed from CMAKE_OSX_DEPLOYMENT_TARGET if not explicitly set. Can anyone comment on how this works, because in my setup it seems to be failing. This showed up as -isysroot not being passed to the compiler, which then causes weird compile failures building on High Sierra with Xcode 10 and the 10.14 SDK.

If explicitly set SDKROOT or CMAKE_OSX_SYSROOT to the 10.14 SDK, everything compiles fine. (Without passing -isysroot, some header is /usr/include are used, and apparently these don’t work for building the 10.14 frameworks)

Deployment target is set to:

        set(CMAKE_OSX_DEPLOYMENT_TARGET "10.7”)

Note that I do this *after* calling project() because contrary to its docs, I find that when I call it before project(), it has no effect. (eg, passing -mmacosx-version-min=10.7 to the compiler).

Full CMakeList.txt is here:

        https://sourceforge.net/p/flightgear/flightgear/ci/next/tree/CMakeLists.txt

Any comments on what is going on, would be appreciated.


You need to set CMAKE_OSX_DEPLOYMENT_TARGET as a cache variable before calling the project() command. If you set it as a normal (i.e. non-cache) variable, the compiler detection logic triggered by the project() call creates a cache variable if one doesn't exist, which would discard the non-cache variable. It's a bit unfortunate, but that's what happens when you set a cache variable for the first time. The relevant code related to your observations is in Modules/Platform/Darwin-Initialize.cmake.

 
--
Craig Scott
Melbourne, Australia


--

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:
https://cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: Computation of CMAKE_OSX_SYSROOT

CMake mailing list


On 1 Oct 2018, at 14:25, Craig Scott <[hidden email]> wrote:

You need to set CMAKE_OSX_DEPLOYMENT_TARGET as a cache variable before calling the project() command. If you set it as a normal (i.e. non-cache) variable, the compiler detection logic triggered by the project() call creates a cache variable if one doesn't exist, which would discard the non-cache variable. It's a bit unfortunate, but that's what happens when you set a cache variable for the first time. The relevant code related to your observations is in Modules/Platform/Darwin-Initialize.cmake.

Thanks, that was indeed the solution.

I’d suggest the docs page for CMAKE_OSX_DEPLOYMENT_TARGET could use some wording to point this out, but I don’t know who . how a docs change gets done.

James

--

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:
https://cmake.org/mailman/listinfo/cmake

smime.p7s (5K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Computation of CMAKE_OSX_SYSROOT

Robert Maynard
Documentation changes can be done through the CMake project hosted on gitlab. You would want to modify the file: https://gitlab.kitware.com/cmake/cmake/blob/master/Help/variable/CMAKE_OSX_DEPLOYMENT_TARGET.rst



On Mon, Oct 1, 2018 at 11:13 AM James Turner via CMake <[hidden email]> wrote:


On 1 Oct 2018, at 14:25, Craig Scott <[hidden email]> wrote:

You need to set CMAKE_OSX_DEPLOYMENT_TARGET as a cache variable before calling the project() command. If you set it as a normal (i.e. non-cache) variable, the compiler detection logic triggered by the project() call creates a cache variable if one doesn't exist, which would discard the non-cache variable. It's a bit unfortunate, but that's what happens when you set a cache variable for the first time. The relevant code related to your observations is in Modules/Platform/Darwin-Initialize.cmake.

Thanks, that was indeed the solution.

I’d suggest the docs page for CMAKE_OSX_DEPLOYMENT_TARGET could use some wording to point this out, but I don’t know who . how a docs change gets done.

James
--

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:
https://cmake.org/mailman/listinfo/cmake

--

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:
https://cmake.org/mailman/listinfo/cmake