MantisBT - CMake
View Issue Details
0007643CMakeModulespublic2008-09-09 20:252016-06-10 14:30
Preston A. Elder 
Brad King 
normalfeaturealways
closedmoved 
CMake-2-6 
 
0007643: Cmake should add expanded compiler flag support.
From the email chain:

>> As I said, there are other things that need to be done such as:
>> - Adjusting warning levels (CMAKE_WARN_LEVEL=(None|Full|Standard) )
>> - Forcing a 32-bit or 64-bit compile
>> - Allowing for platform-specific builds if possible (ie. don't maintain
>> i386 compatibility, compile specifically for i686).
>>
>> Most of these can be done in all supported compilers, but the flags for
>> doing so are different per-compiler. Since the Platform directory
>> exists (thanks for pointing it out, I didn't see it before), is there
>> any thoughts on an effort to expand this to more than just optimization
>> and debug flags?

I've been wanting to implement something like this for years, but
haven't had the time to actually do it. The feature would work in terms
of directory, target, and source file properties. It would be similar
to the COMPILE_DEFINITIONS properties:

http://www.cmake.org/Wiki/CMake_2.6_Notes#Preprocessor_Definitions [^]
http://www.cmake.org/HTML/cmake-2.6.html#prop_dir:COMPILE_DEFINITIONS [^]
http://www.cmake.org/HTML/cmake-2.6.html#prop_tgt:COMPILE_DEFINITIONS [^]
http://www.cmake.org/HTML/cmake-2.6.html#prop_sf:COMPILE_DEFINITIONS [^]

and their per-configuration equivalents. Such a property might accept
one out of an enumerated list of pre-defined possible values. Each
value would map to the appropriate flag for the native tool.

It might look something like this:

# Apply to all targets in this directory and below.
set_directory_properties(PROPERTIES
  OPTIMIZATION_LEVEL_DEBUG none # no optimizations for Debug
  OPTIMIZATION_LEVEL_RELEASE max # max optimizations for Release
  OPTIMIZATION_LEVEL default # compiler default for other configs
  WARNING_LEVEL none # disable all warnings in all configurations
  )
# apply to 'tiny' executable, overriding directory default
set_property(TARGET tiny PROPERTY
  OPTIMIZATION_LEVEL size # optimize for size in all configurations
  )

Of course we could create commands or macros to shorten the syntax for
common cases.

-Brad
No tags attached.
related to 0003811closed Brad King Add portable flag to treat warnings as errors 
Issue History
2008-09-09 20:25Preston A. ElderNew Issue
2008-09-11 10:20Bill HoffmanStatusnew => assigned
2008-09-11 10:20Bill HoffmanAssigned To => Brad King
2009-04-03 12:23MrDoomMasterNote Added: 0015901
2012-08-13 10:36Brad KingStatusassigned => backlog
2012-08-13 10:36Brad KingNote Added: 0030495
2013-11-02 11:22Stephen KellyRelationship addedrelated to 0003811
2016-06-10 14:27Kitware RobotNote Added: 0041449
2016-06-10 14:27Kitware RobotStatusbacklog => resolved
2016-06-10 14:27Kitware RobotResolutionopen => moved
2016-06-10 14:30Kitware RobotStatusresolved => closed

Notes
(0015901)
MrDoomMaster   
2009-04-03 12:23   
I would like to add my vote for this list of functionality. I've been needing to set optimization and warning levels via CMake but it has been far from intuitive or sometimes not even possible.

I would really love to see this in version 2.6.4 if possible! Thanks for hearing the community on this!
(0030495)
Brad King   
2012-08-13 10:36   
Sending issues I'm not actively working on to the backlog to await someone with time for them.

If an issue you care about is sent to the backlog when you feel it should have been addressed in a different manner, please bring it up on the CMake mailing list for discussion. Sign up for the mailing list here, if you're not already on it:

 http://www.cmake.org/mailman/listinfo/cmake [^]

It's easy to re-activate a bug here if you can find a CMake developer or contributor who has the bandwidth to take it on.
(0041449)
Kitware Robot   
2016-06-10 14:27   
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.