cmake: Fix dependencies so builds are sparse again

In cmake we use target_byproducts() to register dependence on the map
file alongside the executable for it - this makes sense.
Thus if the map file is missing, ninja will detect and issue a linker
command again. However after that, cmake was instructed to rename the
map file. Thus a 2nd round of ninja, which should be a no-op, is not as
the registered byproduct file is missing.

To keep this static, and to keep the map file alongside the elf file, we
will instead copy the map file.

Signed-off-by: Mark Ruvald Pedersen <mped@oticon.com>
This commit is contained in:
Mark Ruvald Pedersen 2022-03-16 13:21:39 +01:00 committed by Marti Bolivar
commit d8df801fe4

View file

@ -1405,7 +1405,7 @@ set(post_build_byproducts "")
list(APPEND
post_build_commands
COMMAND
${CMAKE_COMMAND} -E rename ${logical_target_for_zephyr_elf}.map ${KERNEL_MAP_NAME}
${CMAKE_COMMAND} -E copy ${logical_target_for_zephyr_elf}.map ${KERNEL_MAP_NAME}
)
list(APPEND post_build_byproducts ${KERNEL_MAP_NAME})