Skip to content

Commit

Permalink
Do not downgrade optimization level for gcc-14 and above
Browse files Browse the repository at this point in the history
Release configuration seems to be working fine
  • Loading branch information
TheMostDiligent committed Feb 3, 2025
1 parent 5a7c807 commit cdca8af
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -521,8 +521,8 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
)
endif()
elseif (CMAKE_CXX_COMPILER_ID MATCHES "GNU")
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "9.0")
message(WARNING "gcc 9.0 and above seemingly produce invalid binary code with O2 and O3 optimization levels. Optimization in release configurations will be downgraded to O1. It is strongly recommended to use clang.")
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "9.0" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS "14.0")
message(WARNING "This version of gcc may produce invalid binary code with O2 and O3 optimization levels. Optimization in release configurations will be downgraded to O1.")
set(GCC_OPTIMIZATION_LEVEL "-O1")
target_compile_options(Diligent-BuildSettings INTERFACE $<$<CONFIG:Release,RelWithDebInfo>:${GCC_OPTIMIZATION_LEVEL}>)
endif()
Expand Down

0 comments on commit cdca8af

Please sign in to comment.