[prev in list] [next in list] [prev in thread] [next in thread] 

List:       cmake
Subject:    [CMake] Where do all the extra clang flags come from in Xcode?
From:       Paul Smith <paul () mad-scientist ! net>
Date:       2015-05-14 21:53:22
Message-ID: 1431640402.3092.169.camel () mad-scientist ! net
[Download RAW message or body]

I was comparing the command line used when we choose an Xcode generator
on our OSX systems, vs. the command line used when we choose a Makefile
generator.  We certainly have nothing in our CMakeLists.txt which sets
compiler flags based on the type of generator, only based on the type of
compiler (GCC, Clang, etc.)

But, when I look at the compiler and flags used by the Makefile
generator it uses /usr/bin/c++ (which is clang++ underneath) and it's
basically only the the compiler flags that we provided.

When I look at the compiler and flags used by the Xcode generator, not
only does it use a different path to the compiler
(/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang \
-x c++) but, more concerning (because I assume that /usr/bin/clang++ eventually gets \
down to the same actual compiler as above) but it contains a huge number of extra \
flags, for example it appears to disable all sorts of warnings (that we don't want \
disabled):  -Wno-missing-prototypes, -Wno-return-type, -Wno-non-virtual-dtor, \
-Wno-overloaded-virtual, etc. etc.

This means people who build on OSX using Makefile generators see extra
warnings that people who build on OSX using Xcode don't see.

Where are these extra flags all coming from?  Is it from Xcode itself
somehow?  Can I keep them from being added?  I don't want peoples'
personal Xcode settings to disable warnings during compilation!

Note these are build servers and so no one is actually invoking Xcode:
we log in via SSH, use cmake to generate the Xcode project files, then
use cmake -build (which runs xcodebuild) to run the build itself.

-- 

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:
http://public.kitware.com/mailman/listinfo/cmake


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic