[cmake-developers] [CMake 0014753]: Place CMAKE_CXX_FLAGS_DEBUG before CMAKE_CXX_FLAGS, not after (for all similar flags)

Mantis Bug Tracker mantis at public.kitware.com
Wed Feb 12 20:08:25 EST 2014


The following issue has been SUBMITTED. 
====================================================================== 
http://public.kitware.com/Bug/view.php?id=14753 
====================================================================== 
Reported By:                Dmiry Marakasov
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   14753
Category:                   CMake
Reproducibility:            always
Severity:                   tweak
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2014-02-12 20:08 EST
Last Modified:              2014-02-12 20:08 EST
====================================================================== 
Summary:                    Place CMAKE_CXX_FLAGS_DEBUG before CMAKE_CXX_FLAGS,
not after (for all similar flags)
Description: 
The 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.
====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2014-02-12 20:08 Dmiry MarakasovNew Issue                                    
======================================================================



More information about the cmake-developers mailing list