[CMake] Why does CMake set CMAKE_OSX_SYSROOT using the Xcode generator?
Kyle Sluder
kyle at ksluder.com
Tue Feb 18 03:02:04 EST 2014
I'm trying to build LLVM via Xcode. In order to do that, I have to fix
some explicit uses of "-isysroot", since it results in Xcode targets
that try to build for the simulator with two -isysroot flags pointing at
two different SDKs. Instead I'm trying to set XCODE_ATTRIBUTE_SDKROOT to
the appropriate value so that Xcode's project settings result in the
appropriate '-isysroot' flag.
But I'm being stymied by CMake, which is insisting on setting
CMAKE_OSX_SYSROOT to my current platform's SDK despite the fact that I'm
using the Xcode generator.
Looking at Darwin.cmake at HEAD, this seems to be intentional:
114 elseif("${CMAKE_GENERATOR}" MATCHES Xcode
115 OR CMAKE_OSX_DEPLOYMENT_TARGET
116 OR CMAKE_OSX_ARCHITECTURES MATCHES "[^;]"
117 OR NOT EXISTS "/usr/include/sys/types.h")
118 # Find installed SDKs in either Xcode-4.3+ or pre-4.3 SDKs
directory.
119 set(_CMAKE_OSX_SDKS_DIR "")
120 if(OSX_DEVELOPER_ROOT)
121 foreach(d Platforms/MacOSX.platform/Developer/SDKs SDKs)
[. . .]
I don't see why this would be considered a good idea when using the
Xcode generator. It's just going to result in redundant '-isysroot'
flags, isn't it?
--Kyle Sluder
More information about the CMake
mailing list