Skip to content

Commit

Permalink
Bug #32287863 BACKPORT THE PATCH FOR BUG #27874068 ADD SUPPORT FOR -D…
Browse files Browse the repository at this point in the history
…CMAKE_BUILD_TYPE=RELEASE

Follow-up patch:
re-enable -O3 by default for RelWithDebInfo (and Release) builds on Linux.

Change-Id: Ica5190aa1d6f6539ad629d93c10e4a0fd0bcdd2d
  • Loading branch information
Tor Didriksen authored and surbhat1595 committed Mar 26, 2021
1 parent 15c5acd commit a9b0c71
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions cmake/build_configurations/compiler_options.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -182,4 +182,19 @@ IF(UNIX)
STRING_PREPEND(CMAKE_CXX_FLAGS_RELEASE "${SECTIONS_FLAG} ")
STRING_PREPEND(CMAKE_CXX_FLAGS_MINSIZEREL "${SECTIONS_FLAG} ")

# We need -O3 by default for RelWithDebInfo in order to avoid
# performance regressions from earlier releases.
# To disable this (and everything else in this file),
# do 'cmake -DWITH_DEFAULT_COMPILER_OPTIONS=NO'.
IF(LINUX)
FOREACH(flag
CMAKE_C_FLAGS_RELEASE
CMAKE_C_FLAGS_RELWITHDEBINFO
CMAKE_CXX_FLAGS_RELEASE
CMAKE_CXX_FLAGS_RELWITHDEBINFO
)
STRING(REPLACE "-O2" "-O3" "${flag}" "${${flag}}")
ENDFOREACH()
ENDIF()

ENDIF()

0 comments on commit a9b0c71

Please sign in to comment.