Bug 875954 - macros.cmake: respect $RPM_OPT_FLAGS better by default
Summary: macros.cmake: respect $RPM_OPT_FLAGS better by default
Alias: None
Product: Fedora
Classification: Fedora
Component: cmake
Version: rawhide
Hardware: Unspecified
OS: Unspecified
Target Milestone: ---
Assignee: Orion Poplawski
QA Contact: Fedora Extras Quality Assurance
Depends On:
TreeView+ depends on / blocked
Reported: 2012-11-12 22:34 UTC by Rex Dieter
Modified: 2013-05-30 03:37 UTC (History)
8 users (show)

Fixed In Version: cmake-2.8.11-1.fc19
Doc Type: Enhancement
Doc Text:
Clone Of:
Last Closed: 2013-05-30 03:37:53 UTC
Type: Bug

Attachments (Terms of Use)

Description Rex Dieter 2012-11-12 22:34:42 UTC
$Summary says it all, consider setting
in %cmake by default in /etc/rpm/macros.cmake , while making it easy to set/override manually, similar to how %_cmake_lib_suffix64 is currently handled.

GNU.cmake contains:
  set(CMAKE_${lang}_FLAGS_DEBUG_INIT "-g")

Currently, many projects default to CMAKE_BUILD_TYPE=Release, and end up pulling in -O3 (and -DNDEBUG), and in some cases, the -O3 is undesirable.

One side-effect of implementing this, is that -DNDEBUG will get used by default too, which may or may not be desirable.

Comment 1 Rex Dieter 2012-11-12 22:47:30 UTC
Started -devel ml thread,

Comment 2 Kevin Kofler 2012-11-13 22:29:30 UTC
IMHO, a better fix is to change the -O3 to -O2 in the GNU.cmake we install.

Comment 3 Kevin Kofler 2012-11-13 22:31:27 UTC
(I'm uncomfortable with changing the default build type because projects override those default flags in several different ways, and in particular some (like KDE, IIRC) don't use NDEBUG or similar flags under RelWithDebInfo.)

Comment 4 Mamoru TASAKA 2013-04-09 00:26:32 UTC
I think at least -O3 must be killed on Fedora, see some discussions on
bug 929256 (this will perhaps confuse new Fedora packagers).

Comment 5 Rex Dieter 2013-04-18 15:17:13 UTC
adjusting $Summary, since using ReleaseWithDebInfo is likely no longer an option, given our prior conversations.

Now, on irc we came up with:

[04/18/13 10:11] <orionp> I don't like it that CMAKE adds the default flags *after* the specified CXXFLAGS
[04/18/13 10:13] <rdieter> orionp: maybe we could switch it around, i'm still looking where that happens
[04/18/13 10:13] <rdieter> Modules/CMakeCXXInformation.cmake : set(CMAKE_CXX_FLAGS_INIT "$ENV{CXXFLAGS} ${CMAKE_CXX_FLAGS_INIT}")
[04/18/13 10:14] <rdieter> orionp: so instead of prepending CXXFLAGS, postpend instead ?
[04/18/13 10:14] <rdieter> heh, invented a new word, how about append? :)
[04/18/13 10:14] <orionp> Yeah, but this should be run by upstream.

Comment 6 Rex Dieter 2013-04-18 15:19:35 UTC
or... :)

[04/18/13 10:18] <orionp> rdieter - I think we should set CMAKE_*_FLAGS_INIT in the %cmake macro for now
[04/18/13 10:18] <rdieter> ok, that's reasonable too

Comment 7 Orion Poplawski 2013-04-18 15:47:42 UTC
So, for an immediate fix I suggest adding to the cmake macro:


How does that sound?

Comment 8 Rex Dieter 2013-04-18 15:50:15 UTC

Comment 9 Orion Poplawski 2013-04-18 16:17:13 UTC
This is in rawhide with cmake-2.8.11-0.6.rc2.fc20.  When 2.8.11 goes final I'll push it out to the releases.

Comment 10 Fedora Update System 2013-05-19 02:43:01 UTC
cmake-2.8.11-1.fc19 has been submitted as an update for Fedora 19.

Comment 11 Fedora Update System 2013-05-19 18:18:53 UTC
Package cmake-2.8.11-1.fc19:
* should fix your issue,
* was pushed to the Fedora 19 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing cmake-2.8.11-1.fc19'
as soon as you are able to.
Please go to the following url:
then log in and leave karma (feedback).

Comment 12 Fedora Update System 2013-05-30 03:37:53 UTC
cmake-2.8.11-1.fc19 has been pushed to the Fedora 19 stable repository.  If problems still persist, please make note of it in this bug report.

Note You need to log in before you can comment on or make changes to this bug.