Skip to content

Commit

Permalink
[FIXUP] cmake: Do not prepend -O0 if flags have any -O flag
Browse files Browse the repository at this point in the history
  • Loading branch information
hebasto committed May 21, 2024
1 parent c483fa7 commit f094511
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,9 @@ else()
endif()
unset(compiler_supports_ftrapv)

string(PREPEND CMAKE_CXX_FLAGS_DEBUG "-O0 ")
if(NOT CMAKE_CXX_FLAGS_DEBUG MATCHES "(^| )-O[^ ]*")
string(PREPEND CMAKE_CXX_FLAGS_DEBUG "-O0 ")
endif()

set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}"
CACHE STRING
Expand All @@ -472,7 +474,9 @@ else()
replace_c_flag_in_config(Debug -g -g3)
endif()

string(PREPEND CMAKE_C_FLAGS_DEBUG "-O0 ")
if(NOT CMAKE_C_FLAGS_DEBUG MATCHES "(^| )-O[^ ]*")
string(PREPEND CMAKE_C_FLAGS_DEBUG "-O0 ")
endif()

set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}"
CACHE STRING
Expand Down

0 comments on commit f094511

Please sign in to comment.