replace file(copy by cmake -E copy

pull/15117/head
Johannes Stratmann 2021-10-05 17:16:00 +02:00
parent d4062f5fcb
commit 5ae8e0eec0
1 changed files with 14 additions and 5 deletions

View File

@ -88,11 +88,20 @@ function(mbed_set_post_build target)
# executable suffix for all toolchains as CMake hardcodes the name of the
# diagnostic output file for some toolchains.
# COPY_FILE could be used with cmake >=3.21
file(COPY_FILE
"${CMAKE_CURRENT_BINARY_DIR}/${target}${CMAKE_EXECUTABLE_SUFFIX}.map"
"${CMAKE_CURRENT_BINARY_DIR}/${target}${CMAKE_EXECUTABLE_SUFFIX}.map.old"
RESULT 0)
# copy mapfile .map to .map.old for ram/rom statistics diff in memap.py
if(EXISTS ${CMAKE_CURRENT_BINARY_DIR}/${target}${CMAKE_EXECUTABLE_SUFFIX}.map)
add_custom_command(
TARGET
${target}
PRE_BUILD
COMMAND
${CMAKE_COMMAND} -E rename "${CMAKE_CURRENT_BINARY_DIR}/${target}${CMAKE_EXECUTABLE_SUFFIX}.map" "${CMAKE_CURRENT_BINARY_DIR}/${target}${CMAKE_EXECUTABLE_SUFFIX}.map.old"
COMMENT
"executable:"
VERBATIM
)
endif()
mbed_configure_memory_map(${target} "${CMAKE_CURRENT_BINARY_DIR}/${target}${CMAKE_EXECUTABLE_SUFFIX}.map")
mbed_validate_application_profile(${target})
mbed_generate_bin_hex(${target})