Use a cleaner CMake method to handle bin and hex file names

pull/15339/head
Jamie Smith 2022-07-09 11:15:25 -07:00 committed by Jay Sridharan
parent 0874f74ae9
commit 5442e2405c
2 changed files with 5 additions and 6 deletions

View File

@ -46,7 +46,10 @@ set(MBED_UPLOAD_SUPPORTS_DEBUG ${UPLOAD_SUPPORTS_DEBUG} CACHE INTERNAL "" FORCE)
function(mbed_generate_upload_debug_targets target) function(mbed_generate_upload_debug_targets target)
# add upload target # add upload target
gen_upload_target(${target} ${CMAKE_CURRENT_BINARY_DIR}/${target}.bin ${CMAKE_CURRENT_BINARY_DIR}/${target}.hex) gen_upload_target(${target}
${CMAKE_CURRENT_BINARY_DIR}/$<TARGET_FILE_BASE_NAME:${target}>.bin
${CMAKE_CURRENT_BINARY_DIR}/$<TARGET_FILE_BASE_NAME:${target}>.hex
)
# add debug target # add debug target
if(MBED_UPLOAD_SUPPORTS_DEBUG) if(MBED_UPLOAD_SUPPORTS_DEBUG)

View File

@ -6,12 +6,8 @@
# #
function(mbed_generate_bin_hex target) function(mbed_generate_bin_hex target)
get_property(elf_to_bin GLOBAL PROPERTY ELF2BIN) get_property(elf_to_bin GLOBAL PROPERTY ELF2BIN)
get_target_property(artifact_name ${target} ARTIFACT_NAME)
# set to the target name if the property is unset set(artifact_name $<TARGET_FILE_BASE_NAME:${target}>)
if(artifact_name STREQUAL "artifact_name-NOTFOUND" OR artifact_name STREQUAL "")
set(artifact_name ${target})
endif()
if (MBED_TOOLCHAIN STREQUAL "GCC_ARM") if (MBED_TOOLCHAIN STREQUAL "GCC_ARM")
# The first condition is quoted in case MBED_OUTPUT_EXT is unset # The first condition is quoted in case MBED_OUTPUT_EXT is unset