Skip to content

Commit ab43414

Browse files
authored
Upload: Fix mbed_adjust_upload_debug_commands for multiple targets (#391)
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.
1 parent 8974db5 commit ab43414

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

tools/cmake/UploadMethodManager.cmake

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,14 @@
1212
# NOTE: Place at the very start so that it can override by the below loaded
1313
# upload method if need be.
1414
function(mbed_adjust_upload_debug_commands target)
15-
# MBED_UPLOAD_LAUNCH_COMMANDS defined?
16-
if(NOT DEFINED MBED_UPLOAD_LAUNCH_COMMANDS)
15+
# MBED_UPLOAD_LAUNCH_COMMANDS_BAK = first version of MBED_UPLOAD_LAUNCH_COMMANDS
16+
if(DEFINED MBED_UPLOAD_LAUNCH_COMMANDS_BAK)
17+
# Need first version for fresh adjust
18+
set(MBED_UPLOAD_LAUNCH_COMMANDS ${MBED_UPLOAD_LAUNCH_COMMANDS_BAK})
19+
elseif(DEFINED MBED_UPLOAD_LAUNCH_COMMANDS)
20+
# No FORCE for saving first version only
21+
set(MBED_UPLOAD_LAUNCH_COMMANDS_BAK ${MBED_UPLOAD_LAUNCH_COMMANDS} CACHE INTERNAL "")
22+
else()
1723
return()
1824
endif()
1925

0 commit comments

Comments
 (0)