@@ -72,6 +72,20 @@ target_compile_definitions(mbed-core
72
72
${MBED_CONFIG_DEFINITIONS}
73
73
)
74
74
75
+ # We need to generate a "response file" to pass to the C preprocessor when we preprocess the linker
76
+ # script, because of path length limitations on Windows. We set the response file and bind the path
77
+ # to a global property here. The MBED_TARGET being built queries this global property when it sets
78
+ # the linker script.
79
+ #
80
+ # We must set this global property before the targets subdirectory is added to the project. This is
81
+ # required because the MBED_TARGET depends on the response file. If the path to the response file
82
+ # is not defined when the target requests it the config definitions will not be passed to CPP.
83
+ #
84
+ # TODO: Remove this and find a more idiomatic way of passing compile definitions to CPP without
85
+ # using response files or global properties.
86
+ mbed_generate_options_for_linker (mbed-core RESPONSE_FILE_PATH )
87
+ set_property (GLOBAL PROPERTY COMPILE_DEFS_RESPONSE_FILE ${RESPONSE_FILE_PATH} )
88
+
75
89
# Add compile definitions for backward compatibility with the toolchain
76
90
# supported. New source files should instead check for __GNUC__ and __clang__
77
91
# for the GCC_ARM and ARM toolchains respectively.
@@ -144,15 +158,6 @@ endif()
144
158
# Note, this function will be removed in the next revisions
145
159
#
146
160
function (mbed_configure_app_target target )
147
- # We need to generate a "response file" to pass to the C preprocessor because of path length
148
- # limitations on Windows. We set the response file and bind the path to a global property here.
149
- # We query this global property when we set the linker script for the MBED_TARGET being built.
150
- #
151
- # TODO: Remove this and find a more idiomatic way of passing compile definitions to CPP without
152
- # using global properties.
153
- mbed_generate_options_for_linker (${target} LINKER_PREPROCESS_DEFINITIONS )
154
- set_property (GLOBAL PROPERTY COMPILE_DEFS_RESPONSE_FILE ${LINKER_PREPROCESS_DEFINITIONS} )
155
-
156
161
# Gcc Arm requires memap to be set with app name, equally to ARMClang
157
162
# TODO: move this to toolchain and set properly
158
163
if (MBED_TOOLCHAIN STREQUAL "GCC_ARM" )
0 commit comments