On Mon, Oct 1, 2018 at 10:53 PM James Turner via CMake <cmake@cmake.org> 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 https://crascit.com New book released: Professional CMake: A Practical Guide <https://crascit.com/professional-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