Skip to content

Commit

Permalink
Fix PICO_DEOPTIMIZED_DEBUG not updating compiler flags (#1620)
Browse files Browse the repository at this point in the history
* Fix PICO_DEOPTIMIZED_DEBUG not updating compiler flags

Setting CMAKE_${LANG}_FLAGS_DEBUG_INIT specifically only sets the flags for the Debug config the first time it is configured by CMake, pulling the initially-configured flags from CMakeCache.txt on subsequent configurations. This causes PICO_DEOPTIMIZED_DEBUG to not have any effect after the initial configuration, causing breakpoint issues when debugging certain functions.

Clearing the cache of the debug flags allows the flags to be updated every configuration, and appended to appropriately (such as with "-g").

See Issue #1618 and the comments of Pull Request #1620 for further details.

Fixes #1618
  • Loading branch information
recursivenomad authored Jun 21, 2024
1 parent f5fea7f commit 2de70c7
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions cmake/preload/toolchains/set_flags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
get_property(IS_IN_TRY_COMPILE GLOBAL PROPERTY IN_TRY_COMPILE)
foreach(LANG IN ITEMS C CXX ASM)
set(CMAKE_${LANG}_FLAGS_INIT "${ARM_TOOLCHAIN_COMMON_FLAGS}")
unset(CMAKE_${LANG}_FLAGS_DEBUG CACHE)
if (PICO_DEOPTIMIZED_DEBUG)
set(CMAKE_${LANG}_FLAGS_DEBUG_INIT "-O0")
else()
Expand Down

0 comments on commit 2de70c7

Please sign in to comment.