Opened 9 years ago

Closed 9 years ago

#40711 closed defect (duplicate)

cmake @ - downstream software loses -O3 flag

Reported by: johnsonsr@… Owned by: macports-tickets@…
Priority: Normal Milestone:
Component: ports Version: 2.2.0
Keywords: Cc: cssdev
Port: cmake


Any program newly compiled with the macports CMake will no longer use the -O3 flag when compiled as a "Release" code. This does not apply just to downstream macports installations but also to the user's custom installations that use the MacPorts-installed cmake.

Basically, the CMake variable "CMAKE_CXX_FLAGS_RELEASE" is normally set to "-O3 -DNDEBUG" but an overzealous patch in the macports scripts changes this to " -DNDEBUG".

Due to a change in revision 110069:

eval reinplace "s|-O3||g" [glob ${worksrcpath}/Modules/{Compiler,Platform}/*.cmake]

the CMake flag variables are changed from

./Modules/Compiler/GNU.cmake:47:  set(CMAKE_${lang}_FLAGS_RELEASE_INIT "-O3 -DNDEBUG")


./Modules/Compiler/GNU.cmake:47:  set(CMAKE_${lang}_FLAGS_RELEASE_INIT " -DNDEBUG")

This has affected some of our scientific software that we benchmark regularly: the "Release" flag is no longer turning on optimization like it does for a standard CMake installation. This is a very subtle bug that must be fixed ASAP.

Change History (2)

comment:1 Changed 9 years ago by johnsonsr@…

Sorry, just saw this is a duplicate of #40648. The importance of this behavior change cannot be stressed enough .

Last edited 9 years ago by ryandesign (Ryan Schmidt) (previous) (diff)

comment:2 Changed 9 years ago by ryandesign (Ryan Schmidt)

Cc: css@… added
Resolution: duplicate
Status: newclosed
Note: See TracTickets for help on using tickets.