Skip to content

Commit 79bc5ac

Browse files
authored
Merge pull request #15032 from LDong-Arm/response_file_escape
CMake: Fix escaping of quotes in response file
2 parents be31d50 + d4ee3bd commit 79bc5ac

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

tools/cmake/mbed_toolchain.cmake

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,9 @@ function(mbed_generate_options_for_linker target output_response_file_path)
77
"$<TARGET_PROPERTY:${target},INTERFACE_COMPILE_DEFINITIONS>"
88
)
99

10-
# Remove macro definitions that contain spaces as the lack of escape sequences and quotation marks
11-
# in the macro when retrieved using generator expressions causes linker errors.
12-
# This includes string macros, array macros, and macros with operations.
13-
# TODO CMake: Add escape sequences and quotation marks where necessary instead of removing these macros.
10+
# Append -D to all macros and quote them as we pass these as response file to cxx compiler
1411
set(_compile_definitions
15-
"$<FILTER:${_compile_definitions},EXCLUDE, +>"
16-
)
17-
18-
# Append -D to all macros as we pass these as response file to cxx compiler
19-
set(_compile_definitions
20-
"$<$<BOOL:${_compile_definitions}>:-D$<JOIN:${_compile_definitions}, -D>>"
12+
"$<$<BOOL:${_compile_definitions}>:'-D$<JOIN:${_compile_definitions},' '-D>'>"
2113
)
2214
file(GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/compile_time_defs.txt" CONTENT "${_compile_definitions}\n")
2315
set(${output_response_file_path} @${CMAKE_CURRENT_BINARY_DIR}/compile_time_defs.txt PARENT_SCOPE)

0 commit comments

Comments
 (0)