[CMake] CMAKE_OSX_DEPLOYMENT_TARGET vs CMAKE_OSX_SYSROOT

Braden McDaniel braden at endoframe.com
Sun Sep 25 11:53:08 EDT 2016


On Sun, 2016-09-25 at 11:54 +0200, Gregor Jasny wrote:
> On 23/09/2016 22:35, Gregor Jasny wrote:
> > 
> > On 20 Sep 2016, at 16:00, Braden McDaniel <braden at endoframe.com
> > > > > wrote:
> > > > 
> > > > When setting CMAKE_OSX_SYSROOT to the unversioned directory
> > > > name (using Xcode 8, as it happens) and setting
> > > > CMAKE_OSX_DEPLOYMENT_TARGET, I get this error:
> > > > 
> > > > 
> > > > -- The CXX compiler identification is AppleClang 8.0.0.8000038
> > > > CMake Error at /Applications/CMake.app/Contents/share/cmake-
> > > > 3.6/Modules/Platform/Darwin.cmake:76 (message):
> > > > CMAKE_OSX_DEPLOYMENT_TARGET is '10.10' but CMAKE_OSX_SYSROOT:
> > > > 
> > > > "/Applications/Xcode-
> > > > 8.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SD
> > > > Ks/MacOSX.sdk"
> > > > 
> > > > 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.
> > > > Call Stack (most recent call first):
> > > > /Applications/CMake.app/Contents/share/cmake-
> > > > 3.6/Modules/CMakeSystemSpecificInformation.cmake:36 (include)
> > > > CMakeLists.txt:37 (project)
> > > > 
> > > > 
> > > > I'm able to suppress the error by using the versioned (symlink)
> > > > directory; but isn't the premise of this error message invalid?
> > > > As I understand it, since Xcode 7 (or perhaps earlier?), there
> > > > is no requirement that the deployment target match the SDK
> > > > version.
> 
> The deployment target gives you backwards compatibility back to the
> specified version. In your example the binary should be runnable on
> macOS 10.10 and later even that you used a newer SDK. That way you
> have
> access to the latest SDK features which you could use after a
> thorough
> check at runtime.

Yes, that squares with my understanding of the current semantics.

Interestingly, in Xcode 8, the versioned SDK directory is actually a
symlink to the unversioned one.  It would not surprise me if the
versioned SDK directory went away altogether in a future release; this
version number is moot with the current semantics.

> I filed https://gitlab.kitware.com/cmake/cmake/issues/16323 and will
> push a fix soon.

Thanks!

-- 
Braden McDaniel <braden at endoframe.com>


More information about the CMake mailing list