View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0014753CMakeCMakepublic2014-02-12 20:082016-06-10 14:31
ReporterDmitry Marakasov 
Assigned ToKitware Robot 
PrioritynormalSeveritytweakReproducibilityalways
StatusclosedResolutionmoved 
Platformamd64OSFreeBSDOS Version10.0
Product VersionCMake 2.8.12.1 
Target VersionFixed in Version 
Summary0014753: Place CMAKE_CXX_FLAGS_DEBUG before CMAKE_CXX_FLAGS, not after (for all similar flags)
DescriptionThe example below goes to CMAKE_CXX_FLAGS_DEBUG, however the report covers all flags which have CMAKE_BUILD_TYPE-dependent counterparts (e.g. CMAKE_{C,CXX,LINK,...}_FLAGS_*)

Currently, CMAKE_CXX_FLAGS_DEBUG goes to compiler flags after CMAKE_CXX_FLAGS. This is inconvenient, as it does not allow user to override project-set flags with flags suitable for local environment. For example, FreeBSD ports collection has a policy of enforcing systemwide optimization (-Ox) flags on all port builds. These flags are passed via CMAKE_CC_FLAGS/CMAKE_CXX_FLAGS, but when BUILD_TYPE is used (it is) they do not override project-set flags, which is undesirable. The only ways to fix this are either to not use CMAKE_BUILD_TYPE (which is not acceptable as build-type specific flags may contain critical features, e.g. -DNDEBUG which may severely affect performance and program bahavior) or patch CMakeLists.txt to remove unwanted vendor's flags (not very nice either).

Placing CMAKE_*_FLAGS _after_ CMAKE_*_FLAGS_* will allow gracefully overriding of needed flags so that is what I propose.
TagsNo tags attached.
Attached Files

 Relationships

  Notes
(0035096)
Ben Boeckel (developer)
2014-02-12 20:43

This is probably a backwards compatibility issue. Adding CMAKE_${LANG}_FLAGS_${CONFIG}_AFTER might be best. They'd go after CMAKE_${LANG}_FLAGS, but before target- and source file-specific flags. Alternatively, FreeBSD's platform files could have different defaults for per-configuration flags (e.g., -Ox instead of -O3).
(0035097)
Dmitry Marakasov (reporter)
2014-02-12 21:28

> Adding CMAKE_${LANG}_FLAGS_${CONFIG}_AFTER might be best. They'd go after CMAKE_${LANG}_FLAGS, but before target- and source file-specific flags.

Sounds fine.

> Alternatively, FreeBSD's platform files could have different defaults for per-configuration flags (e.g., -Ox instead of -O3).

Won't work since projects redefine these.
(0042485)
Kitware Robot (administrator)
2016-06-10 14:29

Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.

 Issue History
Date Modified Username Field Change
2014-02-12 20:08 Dmitry Marakasov New Issue
2014-02-12 20:43 Ben Boeckel Note Added: 0035096
2014-02-12 21:28 Dmitry Marakasov Note Added: 0035097
2016-06-10 14:29 Kitware Robot Note Added: 0042485
2016-06-10 14:29 Kitware Robot Status new => resolved
2016-06-10 14:29 Kitware Robot Resolution open => moved
2016-06-10 14:29 Kitware Robot Assigned To => Kitware Robot
2016-06-10 14:31 Kitware Robot Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team