Skip to content

Commit d227723

Browse files
committed
CMake: linker script preprocessing moved to mbed_configure_app_target
This fixes the problem for an app/test to define APP_TARGET as requirements. This is not a proper fix but rather a workaround for broken apps/tests currently. We will address this separately via new pull request.
1 parent b334439 commit d227723

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

CMakeLists.txt

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -94,15 +94,6 @@ target_include_directories(mbed-core
9494
${CMAKE_CURRENT_SOURCE_DIR}
9595
)
9696

97-
# We need to generate a "response file" to pass to the C preprocessor because of path length
98-
# limitations on Windows. We set the response file and bind the path to a global property here.
99-
# We query this global property when we set the linker script for the MBED_TARGET being built.
100-
#
101-
# TODO: Remove this and find a more idiomatic way of passing compile definitions to CPP without
102-
# using global properties.
103-
mbed_generate_options_for_linker(${APP_TARGET} LINKER_PREPROCESS_DEFINITIONS)
104-
set_property(GLOBAL PROPERTY COMPILE_DEFS_RESPONSE_FILE ${LINKER_PREPROCESS_DEFINITIONS})
105-
10697
# These targets are made visible here so their source files which
10798
# are spread in different directories can be referenced and can be linked against
10899
# by libraries that depend on them.
@@ -143,6 +134,20 @@ else()
143134
mbed_set_linker_script(mbed-core ${LINKER_SCRIPT})
144135
endif()
145136

137+
#
138+
# Configures the application
139+
#
140+
function(mbed_configure_app_target target)
141+
# We need to generate a "response file" to pass to the C preprocessor because of path length
142+
# limitations on Windows. We set the response file and bind the path to a global property here.
143+
# We query this global property when we set the linker script for the MBED_TARGET being built.
144+
#
145+
# TODO: Remove this and find a more idiomatic way of passing compile definitions to CPP without
146+
# using global properties.
147+
mbed_generate_options_for_linker(${target} LINKER_PREPROCESS_DEFINITIONS)
148+
set_property(GLOBAL PROPERTY COMPILE_DEFS_RESPONSE_FILE ${LINKER_PREPROCESS_DEFINITIONS})
149+
endfunction()
150+
146151
#
147152
# Converts output file of `target` to binary file and to Intel HEX file.
148153
#

0 commit comments

Comments
 (0)