Skip to content

Commit

Permalink
Upload: Fix mbed_adjust_upload_debug_commands for multiple targets
Browse files Browse the repository at this point in the history
The purpose of mbed_adjust_upload_debug_commands() is to adjust
first version of MBED_UPLOAD_LAUNCH_COMMANDS. For multiple executalbe
cmake targets, MBED_UPLOAD_LAUNCH_COMMANDS becomes not fresh and may
cause error. To overcome this, one new cmake cache variable
MBED_UPLOAD_LAUNCH_COMMANDS_BAK is introduced to save first version of
MBED_UPLOAD_LAUNCH_COMMANDS.
  • Loading branch information
ccli8 committed Nov 21, 2024
1 parent cda8a9d commit ac94fa2
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions tools/cmake/UploadMethodManager.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,14 @@
# NOTE: Place at the very start so that it can override by the below loaded
# upload method if need be.
function(mbed_adjust_upload_debug_commands target)
# MBED_UPLOAD_LAUNCH_COMMANDS defined?
if(NOT DEFINED MBED_UPLOAD_LAUNCH_COMMANDS)
# MBED_UPLOAD_LAUNCH_COMMANDS_BAK = first version of MBED_UPLOAD_LAUNCH_COMMANDS
if(DEFINED MBED_UPLOAD_LAUNCH_COMMANDS_BAK)
# Need first version for fresh adjust
set(MBED_UPLOAD_LAUNCH_COMMANDS ${MBED_UPLOAD_LAUNCH_COMMANDS_BAK})
elseif(DEFINED MBED_UPLOAD_LAUNCH_COMMANDS)
# No FORCE for saving first version only
set(MBED_UPLOAD_LAUNCH_COMMANDS_BAK ${MBED_UPLOAD_LAUNCH_COMMANDS} CACHE INTERNAL "")
else()
return()
endif()

Expand Down

0 comments on commit ac94fa2

Please sign in to comment.