Skip to content

Commit 2f3a3c3

Browse files
author
Jamie Smith
authored
Fix CMake dependency error with custom linker scripts (#406)
* Fix CMake dependency error with custom linker scripts * Updates
1 parent 15ab0c3 commit 2f3a3c3

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

tools/cmake/mbed_set_linker_script.cmake

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,7 @@ function(mbed_setup_linker_script mbed_os_target mbed_baremetal_target target_de
6060
add_custom_command(
6161
OUTPUT
6262
${LINKER_SCRIPT_PATH}
63-
PRE_LINK
64-
COMMAND
63+
COMMAND
6564
${CMAKE_COMMAND} -E echo "Preprocess linker script: ${RAW_LINKER_SCRIPT_NAME} -> ${LINKER_SCRIPT_NAME}"
6665
COMMAND
6766
${CMAKE_C_COMPILER} @${linker_defs_response_file}
@@ -115,7 +114,7 @@ endfunction(mbed_setup_linker_script)
115114
function(mbed_set_custom_linker_script target new_linker_script_path)
116115

117116
set(RAW_LINKER_SCRIPT_PATHS ${CMAKE_CURRENT_SOURCE_DIR}/${new_linker_script_path})
118-
set(CUSTOM_LINKER_SCRIPT_PATH ${CMAKE_CURRENT_BINARY_DIR}/${target}.link_spript.ld)
117+
set(CUSTOM_LINKER_SCRIPT_PATH ${CMAKE_CURRENT_BINARY_DIR}/${target}.link_script.ld)
119118

120119
# To avoid path limits on Windows, we create a "response file" and set the path to it as a
121120
# global property. We need this solely to pass the compile definitions to GCC's preprocessor,
@@ -130,7 +129,7 @@ function(mbed_set_custom_linker_script target new_linker_script_path)
130129
${target}
131130
PRE_LINK
132131
COMMAND
133-
${CMAKE_COMMAND} -E echo "Preprocess custom linker script: ${RAW_LINKER_SCRIPT_NAME} -> ${LINKER_SCRIPT_NAME}"
132+
${CMAKE_COMMAND} -E echo "Preprocess custom linker script ${RAW_LINKER_SCRIPT_NAME} to ${LINKER_SCRIPT_NAME}"
134133
COMMAND
135134
${CMAKE_C_COMPILER} @${linker_defs_response_file}
136135
-E -x assembler-with-cpp
@@ -151,6 +150,6 @@ function(mbed_set_custom_linker_script target new_linker_script_path)
151150
PRIVATE
152151
"-T" "${CUSTOM_LINKER_SCRIPT_PATH}"
153152
)
154-
set_property(TARGET ${target} APPEND PROPERTY LINK_DEPENDS ${CUSTOM_LINKER_SCRIPT_PATH})
153+
set_property(TARGET ${target} APPEND PROPERTY LINK_DEPENDS ${RAW_LINKER_SCRIPT_PATHS})
155154

156155
endfunction(mbed_set_custom_linker_script)

0 commit comments

Comments
 (0)