From 68ce1b2f939086631816c367589d755b48b45231 Mon Sep 17 00:00:00 2001 From: Jamie Smith Date: Thu, 19 Dec 2024 00:53:54 -0800 Subject: [PATCH 1/2] Fix CMake dependency error with custom linker scripts --- tools/cmake/mbed_set_linker_script.cmake | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tools/cmake/mbed_set_linker_script.cmake b/tools/cmake/mbed_set_linker_script.cmake index 4170a60870f..6a339304016 100644 --- a/tools/cmake/mbed_set_linker_script.cmake +++ b/tools/cmake/mbed_set_linker_script.cmake @@ -115,7 +115,7 @@ endfunction(mbed_setup_linker_script) function(mbed_set_custom_linker_script target new_linker_script_path) set(RAW_LINKER_SCRIPT_PATHS ${CMAKE_CURRENT_SOURCE_DIR}/${new_linker_script_path}) - set(CUSTOM_LINKER_SCRIPT_PATH ${CMAKE_CURRENT_BINARY_DIR}/${target}.link_spript.ld) + set(CUSTOM_LINKER_SCRIPT_PATH ${CMAKE_CURRENT_BINARY_DIR}/${target}.link_script.ld) # To avoid path limits on Windows, we create a "response file" and set the path to it as a # global property. We need this solely to pass the compile definitions to GCC's preprocessor, @@ -151,6 +151,5 @@ function(mbed_set_custom_linker_script target new_linker_script_path) PRIVATE "-T" "${CUSTOM_LINKER_SCRIPT_PATH}" ) - set_property(TARGET ${target} APPEND PROPERTY LINK_DEPENDS ${CUSTOM_LINKER_SCRIPT_PATH}) endfunction(mbed_set_custom_linker_script) From 0b9997c8aa43eb32cc2b923ce45ef47f552e1982 Mon Sep 17 00:00:00 2001 From: Jamie Smith Date: Thu, 19 Dec 2024 01:18:54 -0800 Subject: [PATCH 2/2] Updates --- tools/cmake/mbed_set_linker_script.cmake | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/cmake/mbed_set_linker_script.cmake b/tools/cmake/mbed_set_linker_script.cmake index 6a339304016..7cc863518e6 100644 --- a/tools/cmake/mbed_set_linker_script.cmake +++ b/tools/cmake/mbed_set_linker_script.cmake @@ -60,8 +60,7 @@ function(mbed_setup_linker_script mbed_os_target mbed_baremetal_target target_de add_custom_command( OUTPUT ${LINKER_SCRIPT_PATH} - PRE_LINK - COMMAND + COMMAND ${CMAKE_COMMAND} -E echo "Preprocess linker script: ${RAW_LINKER_SCRIPT_NAME} -> ${LINKER_SCRIPT_NAME}" COMMAND ${CMAKE_C_COMPILER} @${linker_defs_response_file} @@ -130,7 +129,7 @@ function(mbed_set_custom_linker_script target new_linker_script_path) ${target} PRE_LINK COMMAND - ${CMAKE_COMMAND} -E echo "Preprocess custom linker script: ${RAW_LINKER_SCRIPT_NAME} -> ${LINKER_SCRIPT_NAME}" + ${CMAKE_COMMAND} -E echo "Preprocess custom linker script ${RAW_LINKER_SCRIPT_NAME} to ${LINKER_SCRIPT_NAME}" COMMAND ${CMAKE_C_COMPILER} @${linker_defs_response_file} -E -x assembler-with-cpp @@ -151,5 +150,6 @@ function(mbed_set_custom_linker_script target new_linker_script_path) PRIVATE "-T" "${CUSTOM_LINKER_SCRIPT_PATH}" ) + set_property(TARGET ${target} APPEND PROPERTY LINK_DEPENDS ${RAW_LINKER_SCRIPT_PATHS}) endfunction(mbed_set_custom_linker_script)