<div dir="ltr">Hi Paul,<div class="gmail_extra"><br><div class="gmail_quote">On Mon, May 18, 2015 at 3:20 PM, Paul Smith <span dir="ltr"><<a href="mailto:paul@mad-scientist.net" target="_blank">paul@mad-scientist.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Mon, 2015-05-18 at 12:32 +0200, Ruslan Baratov via CMake wrote:<br>
> This table tells you what attribute you need to set to disable/enable<br>
> specific warning.<br>
<br>
</span>I see, so these are CMake attributes?  That wasn't clear to me.  I<br>
thought they were attributes of Xcode.<br>
<br>
I guess my basic question is, why are all these extra flags to disable<br>
and enable various warnings set in the Xcode generator?  I expected it<br>
would work like the makefile generator, where if you don't set any flags<br>
in CMakeLists.txt then you don't get any warnings enabled (or explicitly<br>
disabled).  It surprises me that when I take the same CMakeLists.txt<br>
file and use a Makefile generator and an Xcode generator, I get very<br>
different compile lines.<br></blockquote><div><br></div><div>If you look at the foo.xcodeproj contents of a very simple CMake project (hello-world style) you'll notice just 1 file and there are not a lot of -W words inside that file either. I see 3 warnings being added by CMake when generating this file.</div><div><br></div><div>That suggests anything else is added by Xcode itself because thats what its default settings are. Xcode (and xcodebuild) has a lot more logics builtin that make. Make is essentially just a dependency-tracking and execution tool and thus cannot make any assumptions about what is being executed when a target is to be 'made'. It cannot add any compile flags that the make-developers deem useful, since the action executed for a target may not be a compile run at all. Xcode on the other hand with its more structured project file has a very clear idea of what is a compile action and what is not and apparently the Apple devs think a certain set of flags are useful for everybody and hence are added to all compiler invocations.</div><div><br></div><div>You'll also notice this when creating a new project inside xcode and then examine and run it outside, i.e. grep for -W flags in the generated files. There are  literally none, but still xcodebuild shows tons of -W flags added to the compiler invocation.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
And secondarily, is there any way to get the Xcode generator to work<br>
like the Makefile generator, where only the warning flags I explicitly<br>
defined in my CMakeLists.txt file are added to the compile/link lines<br>
and no others?<div class="HOEnZb"><div class="h5"><a href="http://cmake.org/cmake/help/consulting.html" target="_blank"></a></div></div></blockquote><div><br></div><div>Given the above, your only options are: propose a patch to cmake (or find someone to do this for you) that enhances the xcode generator to disable all flags that are not explicitly enabled so its closer to the makefile generator. This is however quite a lot of effort upfront and in maintenance since each new xcode version (even just bugfix versions) may need changes to the list.</div><div><br></div><div>The alternative to that is that you blacklist via the mentioned attributes the warnings you don't want to have enabled, each and every one of them individually.</div><div><br></div><div>Andreas</div></div></div></div>