[MacPorts] #41256: cmake portgroup's debug variant sets release optflags

MacPorts noreply at macports.org
Fri Nov 8 04:20:38 PST 2013


#41256: cmake portgroup's debug variant sets release optflags
-----------------------+--------------------------------
 Reporter:  florian@…  |      Owner:  macports-tickets@…
     Type:  request    |     Status:  new
 Priority:  Normal     |  Milestone:
Component:  ports      |    Version:
 Keywords:             |       Port:
-----------------------+--------------------------------
 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.

-- 
Ticket URL: <https://trac.macports.org/ticket/41256>
MacPorts <http://www.macports.org/>
Ports system for OS X


More information about the macports-tickets mailing list