[CMake] Where do all the extra clang flags come from in Xcode?

Ruslan Baratov ruslan_baratov at yahoo.com
Mon May 18 11:10:14 EDT 2015


On 18-May-15 15:20, Paul Smith wrote:
> On Mon, 2015-05-18 at 12:32 +0200, Ruslan Baratov via CMake wrote:
>> This table tells you what attribute you need to set to disable/enable
>> specific warning.
> I see, so these are CMake attributes?  That wasn't clear to me.  I
> thought they were attributes of Xcode.
Please take a look at examples I've sent earlier. I have no idea how I 
can make it even more clearer.
>
> I guess my basic question is, why are all these extra flags to disable
> and enable various warnings set in the Xcode generator?
As far as I know this is Xcode defaults. So I guess you need to ask 
Apple's Xcode support team.
>    I expected it
> would work like the makefile generator, where if you don't set any flags
> in CMakeLists.txt then you don't get any warnings enabled (or explicitly
> disabled).  It surprises me that when I take the same CMakeLists.txt
> file and use a Makefile generator and an Xcode generator, I get very
> different compile lines.
I guess you can open a bug with feature request. Note that only it's not 
enough to just set all this attributes to YES, but also you need to read 
compiler flags (+ build types) and change attributes accordingly.
E.g. -Wno-enum-conversion in CMAKE_CXX_FLAGS automatically must add 
property `XCODE_ATTRIBUTE_CLANG_WANR_ENUM_CONVERSION NO` to all targets.
>
> And secondarily, is there any way to get the Xcode generator to work
> like the Makefile generator, where only the warning flags I explicitly
> defined in my CMakeLists.txt file are added to the compile/link lines
> and no others?
>
Again. Take a look at examples I've sent earlier. The helper function 
works exactly like you want. This is the only way known to me to achieve 
this nicely.

Cheer, Ruslo


More information about the CMake mailing list