[cfe-dev] CMake/Xcode build fails trying to build asan

Kyle Sluder kyle at ksluder.com
Wed Feb 19 09:34:45 PST 2014


On Wed, Feb 19, 2014, at 08:04 AM, Brad King wrote:
> On 02/18/2014 08:40 PM, Kyle Sluder wrote:
> > I think the solution requires not putting the -isysroot and
> > -mmacosx-version-min flags in OTHER_CFLAGS when using the Xcode
> > generator. Instead, the ios targets should set the $(SDKROOT) and
> > $(MACOSX_DEPLOYMENT_TARGET) build settings in the generated pbxproj.
> 
> CMake has builtin features to generate these flags in the appropriate
> place for each generator.  See CMAKE_OSX_SYSROOT and
> CMAKE_OSX_DEPLOYMENT_TARGET:
> 
>  http://cmake.org/gitweb?p=cmake.git;a=blob;f=Help/variable/CMAKE_OSX_SYSROOT.rst;hb=28dcccfa
>  http://cmake.org/gitweb?p=cmake.git;a=blob;f=Help/variable/CMAKE_OSX_DEPLOYMENT_TARGET.rst;hb=28dcccfa
> 
> Note the disclaimer about when they should be set:
> 
>  http://cmake.org/gitweb?p=cmake.git;a=blob;f=Help/variable/CMAKE_OSX_VARIABLE.txt;hb=28dcccfa

Hi Brad,

>From that disclaimer, it sounds like CMake is treating the SDKROOT as
some sort of per-machine global. That is not how these settings are
intended to be used; the SDK and deployment target can be independently
configured for each target in a project, as well as for the project as a
whole. It can also be inherited from any .xcconfig files attached to the
target or the project.

You might not have seen my thread on the CMake mailing list regarding
this: <http://www.cmake.org/pipermail/cmake/2014-February/057038.html>

It is quite common to have a single .xcodeproj that contains two
targets: one for iOS and one for Mac. The same source files are members
of both targets. Through some mechanism I haven't devised yet, Xcode can
distinguish targets that were created from the iOS template or the Mac
template, and sets the root of their settings cascade to the appropriate
platform. This includes the SDKROOT setting.

Am I misunderstanding the disclaimer? If not, I'm afraid it is
ill-defined and does not do what is necessary here.

--Kyle Sluder



More information about the cfe-dev mailing list