View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0006493CMakeCMakepublic2008-03-02 22:502013-11-04 09:33
Reportermuhkuh 
Assigned ToStephen Kelly 
PrioritynormalSeverityfeatureReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0006493: configuration dependent COMPILE_FLAGS for SET_TARGET_PROPERTIES
DescriptionThere already are configuration dependent LINK_FLAGS like LINK_FLAGS_DEBUG, LINK_FLAGS_RELEASE. This could be usefule for COMPILE_FLAGS too.
Additional InformationMy use case for this is generating mutiple versions of the same library using different C runtimes.
TagsNo tags attached.
Attached Filespatch file icon compile_flags_config.patch [^] (841 bytes) 2008-04-21 04:47 [Show Content]
patch file icon compile_flags_config_makefile.patch [^] (1,652 bytes) 2008-05-22 07:08 [Show Content]
diff file icon compile_flags.diff [^] (13,283 bytes) 2008-07-14 10:47 [Show Content]
patch file icon 0001-COMPILE_FLAGS_-CONFIG.patch [^] (13,903 bytes) 2012-10-25 18:30 [Show Content]

 Relationships
has duplicate 0009940closedBrad King support for COMPILE_FLAG_<CONFIG> 
has duplicate 0008362closedBrad King cmake fails executing the command in link.txt with continuation characters in CMAKE_C_FLAGS 
related to 0006269closedStephen Kelly Some CMake commands should support Debug/Release configurations 
related to 0014182closedKitware Robot set_property file.c PROPERTY COMPILE_FLAGS should allow a list of flags 

  Notes
(0010850)
muhkuh (reporter)
2008-03-18 21:45

Additionally it would be a good idea to make a difference between C and CXX flags. These target properties would be nice:

CXX_FLAGS_DEBUG
CXX_FLAGS_RELEASE
CXX_FLAGS_MINSIZEREL
CXX_FLAGS_RELWITHDEBINFO

C_FLAGS_DEBUG
C_FLAGS_RELEASE
C_FLAGS_MINSIZEREL
C_FLAGS_RELWITHDEBINFO
(0011446)
Egon Kocjan (reporter)
2008-04-21 04:46

Separate compiler flags are an absolute necessity for me, so I created a simple hack to add COMPILE_FLAGS_<CONFIG> for Visual Studio generator (patch is attached). I am quite new to cmake, so I don't know how to make it for xcode and makefiles yet, maybe my coworkers will figure it out later when they port the new cmake based build system. It would be nice to have a comment on this feature from cmake developers, before we make too many CMakeLists.txt depend on our hacks ;)
(0012066)
Egon Kocjan (reporter)
2008-05-22 07:09

I've attached a patch to add COMPILE_FLAGS_<CONFIG> for Makefile generator.
(0012695)
Slavoj Písek (reporter)
2008-07-14 10:46

Honestly muhkuh is not the only one who would appreciate COMPILE_FLAGS_<CONFIG>. I need it as well.
Unfortunatelly the patches ekojcan has uploaded are not complete. It does not work for VS6 and newly introduced COMPILE_FLAGS_<CONFIG> works for targets only. To be consistent it is necessary to have COMPILE_FLAGS_<CONFIG> even for source file properties.

I have made and uploaded a new patch. And I hope cmake developers will review it and they will find it useful and integrate it to cmake sources. It would be nice to have it in the next CMake release.
(0013821)
Brad King (manager)
2008-10-09 15:37

FYI, I've been working on a solution for this on-and-off for a couple months. Instead of extending the COMPILE_FLAGS property, which is space-separated for historical reasons, I am creating a new COMPILE_OPTIONS property which is semicolon-separated like everything else in CMake. Unfortunately doing this right (and providing per-config, per-directory, per-target versions) is a bit of a can of worms. It requires some refactoring and cleanup of the VS and Xcode generators. I'm working on it, but it's not done yet.
(0016818)
Lluís Batlle (reporter)
2009-07-07 03:44

Any update on this? We would also like the brad.king work upstream.
Thank you.
(0017655)
Taras (reporter)
2009-09-19 23:36

Yeah and we
(0018131)
Steve Wilson (developer)
2009-10-20 17:16

I'ld like to add myself to the list of those people that are keen to see this change implemented.
(0021558)
Jeremy Coulon (reporter)
2010-07-29 13:47
edited on: 2010-07-29 13:50

I am very interested by this feature !
Is it going to be implemented anytime soon ?

I don't really want to recompile my own patched version of CMake.
So, I tried this workaround but it doesn't work :

set (CMAKE_CXX_FLAGS_DEBUG_BACKUP ${CMAKE_CXX_FLAGS_DEBUG})
set (CMAKE_CXX_FLAGS_DEBUG "/MTd")
add_library (...)
set (CMAKE_CXX_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG_BACKUP})

(0021559)
Brad King (manager)
2010-07-29 14:20

I just pushed the work I mentioned in comment 13821 out to a topic branch:

  http://gitorious.org/~bradking/cmake/bradkings-cmake/commits/compile-options [^]

If anyone would like to rebase, modernize, and finish the work on top of the latest 'master' I can guide you.
(0021589)
Jeremy Coulon (reporter)
2010-08-01 06:52

I tried your branch and it works fine with VS 2003.
(0021590)
Brad King (manager)
2010-08-01 15:22

Great, thanks for trying it. Note that the head of the branch is actually from 2 years ago.

There is a bunch of work needed before we can include these changes. We need at least the following:

 - Rebase on current master (will need conflict resolution)
 - Implement support for all platforms (partially complete)
 - Add tests
 - Documentation of the properties
(0025624)
AndrewF (reporter)
2011-03-02 18:09

I'll just throw in a bump for this issue. We just ran into this limitation when trying to provide the option for setting the /MDd /MD /MTd or /MT flags, for a mixture of static and dynamic library builds, on a cmake generated project in Visual Studio.

It looks like configuration dependent compile flags are by far the best way to make this happen. COMPILE_DEFINITIONS_ don't cut it since it implies an automatic /D infront of the parameters passed in.
(0027016)
jens.koehler@mobotix.com (reporter)
2011-07-07 10:14

I'ld like to add myself to the list of those people that are keen to see this change implemented.
(0027125)
Brad King (manager)
2011-07-29 18:04

Moving to backlog as I have no time to continue work on this now.

Comment 0006493:0021590 describes additional work required. If anyone wants to step forward please post.
(0027142)
David Cole (manager)
2011-08-01 11:19

Brad just put this one in the backlog... I'm not going to put it on the roadmap for 2.8.6 unless somebody else steps forward with more work on this, as noted by Brad in his previous comments here.
(0031338)
viktor11111 (reporter)
2012-10-25 18:32
edited on: 2012-10-25 18:35

this feature is very necessary, please take this time.


updated the old patch for the latest revision

used "0001-COMPILE_FLAGS_-CONFIG.patch"

(0032191)
Paris (reporter)
2013-02-04 10:07

Any update on this one?
Strange that such a basic feature is not worked out since 5 years now...
(0032208)
Sylwester Arabas (reporter)
2013-02-07 09:05

I concur - this would be very useful!
(0032269)
David Manura (reporter)
2013-02-13 14:35

I want this too. It's also discussed on
http://stackoverflow.com/questions/10199904/how-can-i-set-specific-compiler-flags-for-for-a-specific-target-in-a-specific-bu [^]
(0033214)
Stephen Kelly (developer)
2013-06-03 12:52

This is now possible by populating the COMPILE_OPTIONS target property with generator expressions. A target_compile_options command has been added as an abstraction to populating the property.
(0034355)
Robert Maynard (manager)
2013-11-04 09:33

Closing resolved issues that have not been updated in more than 4 months.

 Issue History
Date Modified Username Field Change
2008-03-02 22:50 muhkuh New Issue
2008-03-18 21:45 muhkuh Note Added: 0010850
2008-04-21 04:46 Egon Kocjan Note Added: 0011446
2008-04-21 04:47 Egon Kocjan File Added: compile_flags_config.patch
2008-05-22 07:08 Egon Kocjan File Added: compile_flags_config_makefile.patch
2008-05-22 07:09 Egon Kocjan Note Added: 0012066
2008-07-14 10:46 Slavoj Písek Note Added: 0012695
2008-07-14 10:47 Slavoj Písek File Added: compile_flags.diff
2008-08-19 14:21 Bill Hoffman Status new => assigned
2008-08-19 14:21 Bill Hoffman Assigned To => Brad King
2008-08-19 14:35 Brad King Relationship added related to 0006269
2008-10-09 15:37 Brad King Note Added: 0013821
2009-07-07 03:44 Lluís Batlle Note Added: 0016818
2009-09-19 23:36 Taras Note Added: 0017655
2009-10-20 17:16 Steve Wilson Note Added: 0018131
2010-07-29 13:47 Jeremy Coulon Note Added: 0021558
2010-07-29 13:50 Jeremy Coulon Note Edited: 0021558
2010-07-29 14:20 Brad King Note Added: 0021559
2010-08-01 06:52 Jeremy Coulon Note Added: 0021589
2010-08-01 15:22 Brad King Note Added: 0021590
2010-12-14 17:00 Brad King Relationship added has duplicate 0009940
2011-01-18 11:51 Brad King Relationship added has duplicate 0008362
2011-03-02 18:09 AndrewF Note Added: 0025624
2011-07-07 10:14 jens.koehler@mobotix.com Note Added: 0027016
2011-07-29 18:04 Brad King Note Added: 0027125
2011-07-29 18:04 Brad King Assigned To Brad King =>
2011-07-29 18:04 Brad King Status assigned => backlog
2011-08-01 11:19 David Cole Note Added: 0027142
2012-08-27 07:30 Stephen Kelly Assigned To => Stephen Kelly
2012-08-27 07:30 Stephen Kelly Status backlog => assigned
2012-10-25 18:30 viktor11111 File Added: 0001-COMPILE_FLAGS_-CONFIG.patch
2012-10-25 18:32 viktor11111 Note Added: 0031338
2012-10-25 18:34 viktor11111 Note Edited: 0031338
2012-10-25 18:35 viktor11111 Note Edited: 0031338
2013-02-04 10:07 Paris Note Added: 0032191
2013-02-07 09:05 Sylwester Arabas Note Added: 0032208
2013-02-13 14:35 David Manura Note Added: 0032269
2013-05-31 08:06 Brad King Relationship added related to 0014182
2013-06-03 12:52 Stephen Kelly Note Added: 0033214
2013-06-03 12:52 Stephen Kelly Status assigned => resolved
2013-06-03 12:52 Stephen Kelly Resolution open => fixed
2013-11-04 09:33 Robert Maynard Note Added: 0034355
2013-11-04 09:33 Robert Maynard Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team