View Issue Details [ Jump to Notes ] | [ Print ] | ||||||||
ID | Project | Category | View Status | Date Submitted | Last Update | ||||
0015224 | CMake | CMake | public | 2014-10-28 13:29 | 2015-04-06 09:07 | ||||
Reporter | Ilya | ||||||||
Assigned To | Brad King | ||||||||
Priority | normal | Severity | major | Reproducibility | always | ||||
Status | closed | Resolution | fixed | ||||||
Platform | Apple | OS | Mac OS X | OS Version | 10.10 | ||||
Product Version | CMake 3.0.2 | ||||||||
Target Version | CMake 3.2 | Fixed in Version | CMake 3.2 | ||||||
Summary | 0015224: CMake unconditionally sets WARNING_CFLAGS for each targets overriding project-level option. | ||||||||
Description | CMake not just sets WARNING_CFLAGS to the following: -Wmost -Wno-four-char-constants -Wno-unknown-pragmas but also overrides higher-level options e.g. set via CMAKE_XCODE_ATTRIBUTE. It should remove these 3 definitions, replace them with appropriate Xcode attributes or prepand WARNINGS_CFLAGS with "$(inherited)" so top-level attributes will be respected. | ||||||||
Tags | No tags attached. | ||||||||
Attached Files | |||||||||
Relationships | |
Relationships |
Notes | |
(0037087) Ilya (reporter) 2014-10-28 13:30 |
This is only relevant for the Xcode generator. |
(0037088) Brad King (manager) 2014-10-28 14:07 |
Historically the goal of the Xcode generator in CMake has been to make projects that use CMake build with Xcode, not to generate pretty projects like a human might. Lots more work would be needed to make each flag go to the right project attribute instead of putting them all in OTHER_CFLAGS. (The VS generator does this already, but the Xcode generator does not.) However, the build should work. CMAKE_XCODE_ATTRIBUTE_ is meant for settings that CMake doesn't otherwise know how to generate. CMake does have a place to put the value of CMAKE_C_FLAGS, which should be used for any warning flags you need. They will go in OTHER_CFLAGS and the build should work. |
(0037091) Ilya (reporter) 2014-10-28 16:26 edited on: 2014-10-28 16:28 |
Can you explain why CMake uncoditionally sets these flags to WARNING_CFLAGS? I believe that in this particular case CMake should at least inherit unless user specifically overrides thi attributes by either using variable or target property. |
(0037099) Brad King (manager) 2014-10-29 09:30 |
Re 0015224:0037091: From the history it looks like it was part of the generator when it was first created. Perhaps it was trying to duplicate something Xcode generated in new projects back then. Try this patch (untested): diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 13e6988..5e7a898 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -2314,6 +2314,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target, group->AddObject(this->CreateString("-Wmost")); group->AddObject(this->CreateString("-Wno-four-char-constants")); group->AddObject(this->CreateString("-Wno-unknown-pragmas")); + group->AddObject(this->CreateString("$(inherited)")); buildSettings->AddAttribute("WARNING_CFLAGS", group); } else |
(0037100) Brad King (manager) 2014-10-29 09:31 |
As discussed in 0015225 you should be able to do just add_compile_options( -Wno-long-long ) prior to creating targets and the options will end up on the compilation line. |
(0037102) Ilya (reporter) 2014-10-29 13:26 |
Brad, this patch works :) Will you apply it to mainstream? |
(0037109) Brad King (manager) 2014-10-30 13:35 edited on: 2014-10-31 11:31 |
Thanks for testing. Applied here: Xcode: Inherit global settings in per-target WARNING_CFLAGS http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=820e95d0 [^] |
(0037115) Ruslan Baratov (reporter) 2014-10-31 10:23 |
> Lots more work would be needed to make each flag go to the right project attribute instead of putting them all in OTHER_CFLAGS If anybody interested - here is the mapping between xcode attributes and warning flags: https://github.com/ruslo/leathers/wiki/List#xcodeclang-table [^] I'm using it to generate cross-platform warnings: https://github.com/ruslo/sugar/wiki/Cross-platform-warning-suppression [^] |
(0038437) Robert Maynard (manager) 2015-04-06 09:07 |
Closing resolved issues that have not been updated in more than 4 months. |
Notes |
Issue History | |||
Date Modified | Username | Field | Change |
2014-10-28 13:29 | Ilya | New Issue | |
2014-10-28 13:30 | Ilya | Note Added: 0037087 | |
2014-10-28 14:07 | Brad King | Note Added: 0037088 | |
2014-10-28 16:26 | Ilya | Note Added: 0037091 | |
2014-10-28 16:28 | Ilya | Note Edited: 0037091 | |
2014-10-29 09:30 | Brad King | Note Added: 0037099 | |
2014-10-29 09:31 | Brad King | Note Added: 0037100 | |
2014-10-29 13:26 | Ilya | Note Added: 0037102 | |
2014-10-30 13:35 | Brad King | Note Added: 0037109 | |
2014-10-30 13:36 | Brad King | Assigned To | => Brad King |
2014-10-30 13:36 | Brad King | Status | new => assigned |
2014-10-30 13:36 | Brad King | Target Version | => CMake 3.2 |
2014-10-31 10:23 | Ruslan Baratov | Note Added: 0037115 | |
2014-10-31 11:31 | Brad King | Note Edited: 0037109 | |
2014-11-03 09:33 | Brad King | Status | assigned => resolved |
2014-11-03 09:33 | Brad King | Resolution | open => fixed |
2014-11-03 09:33 | Brad King | Fixed in Version | => CMake 3.2 |
2015-04-06 09:07 | Robert Maynard | Note Added: 0038437 | |
2015-04-06 09:07 | Robert Maynard | Status | resolved => closed |
Issue History |
Copyright © 2000 - 2018 MantisBT Team |