Bug 875954
| Summary: | macros.cmake: respect $RPM_OPT_FLAGS better by default | ||
|---|---|---|---|
| Product: | [Fedora] Fedora | Reporter: | Rex Dieter <rdieter> |
| Component: | cmake | Assignee: | Orion Poplawski <orion> |
| Status: | CLOSED ERRATA | QA Contact: | Fedora Extras Quality Assurance <extras-qa> |
| Severity: | unspecified | Docs Contact: | |
| Priority: | unspecified | ||
| Version: | rawhide | CC: | jreznik, kevin, ltinkl, mtasaka, orion, pertusus, pmachata, rdieter |
| Target Milestone: | --- | Keywords: | FutureFeature |
| Target Release: | --- | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Whiteboard: | |||
| Fixed In Version: | cmake-2.8.11-1.fc19 | Doc Type: | Enhancement |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2013-05-30 03:37:53 UTC | Type: | Bug |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
Started -devel ml thread, http://lists.fedoraproject.org/pipermail/devel/2012-November/174114.html IMHO, a better fix is to change the -O3 to -O2 in the GNU.cmake we install. (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.) I think at least -O3 must be killed on Fedora, see some discussions on bug 929256 (this will perhaps confuse new Fedora packagers). 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.
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 So, for an immediate fix I suggest adding to the cmake macro: -DCMAKE_C_FLAGS_RELEASE:STRING="-DNDEBUG" -DCMAKE_CXX_FLAGS_RELEASE:STRING="-DNDEBUG" -DCMAKE_Fortran_FLAGS_RELEASE:STRING="-DNDEBUG" How does that sound? worksforme 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. cmake-2.8.11-1.fc19 has been submitted as an update for Fedora 19. https://admin.fedoraproject.org/updates/cmake-2.8.11-1.fc19 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: https://admin.fedoraproject.org/updates/FEDORA-2013-8610/cmake-2.8.11-1.fc19 then log in and leave karma (feedback). 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. |
$Summary says it all, consider setting -DCMAKE_BUILD_TYPE=ReleaseWithDebInfo 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") set(CMAKE_${lang}_FLAGS_MINSIZEREL_INIT "-Os -DNDEBUG") set(CMAKE_${lang}_FLAGS_RELEASE_INIT "-O3 -DNDEBUG") set(CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT "-O2 -g -DNDEBUG") ... 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.