Opened 11 years ago
Last modified 7 months ago
#41256 assigned enhancement
cmake-1.1 portgroup: portgroup's debug variant sets release optflags
Reported by: | florian@… | Owned by: | mascguy (Christopher Nielsen) |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | ports | Version: | |
Keywords: | portgroup | Cc: | jeremyhu (Jeremy Huddleston Sequoia), maehne (Torsten Maehne), justin@…, dbevans (David B. Evans) |
Port: | pg-cmake |
Description
This is a follow up of #41142 and #40648.
CMake's debug flags do not include optimization at all. With the cmake portgroup we get -Os. But debug symbols with optimization are not helpful (see comment:4:ticket:41203).
The other point is that CMake's default release flags are -O3 -DNDEBUG and not -Os -DNDEBUG. AFAIK, -Os equals -O2 plus extra code size reduction. So anyone relying on CMake's default will get less optimized builds.
A Portfile workaround would be:
if {[variant_isset debug]} { configure.optflags -O0 } else { configure.optflags -O3 }
I suggest at least modifying cmake-1.0.tcl as such:
variant debug description "Enable debug binaries" { configure.args-delete -DCMAKE_BUILD_TYPE=Release configure.args-append -DCMAKE_BUILD_TYPE=Debug configure.optflags -O0 }
to correct the debug optflags.
Change History (4)
comment:1 Changed 11 years ago by mf2k (Frank Schima)
Type: | request → enhancement |
---|
comment:2 Changed 2 years ago by mascguy (Christopher Nielsen)
Keywords: | portgroup added |
---|
comment:3 Changed 18 months ago by mascguy (Christopher Nielsen)
Owner: | changed from macports-tickets@… to mascguy |
---|---|
Port: | pg-cmake added |
Status: | new → assigned |
Summary: | cmake portgroup's debug variant sets release optflags → pg cmake: portgroup's debug variant sets release optflags |
Since I've started to litter CMake-based ports with logic like that mentioned in the description, it makes sense that I add this to my plate.
Specifically, this is what some of our ports are doing - or with slight variations - and that should arguably be handled by the CMake pgs:
if {[variant_isset debug]} { cmake.build_type Debug configure.optflags -O0 } else { cmake.build_type RelWithDebInfo # Clear optflags for non-debug build; controlled by project configure.optflags }
comment:4 Changed 7 months ago by kencu (Ken)
Summary: | pg cmake: portgroup's debug variant sets release optflags → cmake-1.1 portgroup: portgroup's debug variant sets release optflags |
---|
Add keyword portgroup, to pg-related tickets