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

Parag Chandra parag at ionicsecurity.com
Mon May 18 10:50:25 EDT 2015


This is just a guess, but I think the reason you’re seeing all these extra 
warnings enabled/disabled when you use Xcode is that Xcode is going to, by 
default, enable many of these warnings when you create a new project, and 
CMake isn’t doing anything special to alter those in order to match up 
with the Makefiles it generates. In other words, these flags might very 
well be the same ones you’d see if you were to manually create an Xcode 
project via its wizards.

So in reference to your last question, I don’t think you’re going to be 
able to just ‘whitelist’ the flags you want enabled. You’ll also have to 
take stock of the default flags Xcode enables and ‘blacklist’ those.


Parag Chandra
Senior Software Engineer, Mobile Team
Mobile: +1.919.824.1410

 <https://ionic.com> 

Ionic Security Inc.
1170 Peachtree St. NE STE 400, Atlanta, GA 30309














On 5/18/15, 1:20 PM, "Paul Smith" <paul at mad-scientist.net> 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.
>
>I guess my basic question is, why are all these extra flags to disable
>and enable various warnings set in the Xcode generator?  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.
>
>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?
>
>-- 
>
>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


More information about the CMake mailing list