File tree Expand file tree Collapse file tree 3 files changed +22
-23
lines changed
Expand file tree Collapse file tree 3 files changed +22
-23
lines changed Original file line number Diff line number Diff line change @@ -133,7 +133,7 @@ endfunction()
133133function (mbed_set_mbed_target_linker_script target )
134134 get_property (mbed_target_linker_script GLOBAL PROPERTY MBED_TARGET_LINKER_FILE)
135135 if (MBED_TOOLCHAIN STREQUAL "GCC_ARM" )
136- mbed_generate_gcc_options_for_linker (${target} _linker_preprocess_definitions)
136+ mbed_generate_options_for_linker (${target} _linker_preprocess_definitions)
137137 set (CMAKE_PRE_BUILD_COMMAND
138138 COMMAND "arm-none-eabi-cpp" ${_linker_preprocess_definitions} -x assembler-with-cpp -E -Wp,-P
139139 ${mbed_target_linker_script} -o ${CMAKE_BINARY_DIR} /${target} .link_script.ld
Original file line number Diff line number Diff line change 11# Copyright (c) 2020 ARM Limited. All rights reserved.
22# SPDX-License-Identifier: Apache-2.0
33
4+ # Generate a file containing compile definitions
5+ function (mbed_generate_options_for_linker target definitions_file)
6+ set (_compile_definitions
7+ "$<TARGET_PROPERTY:${target} ,COMPILE_DEFINITIONS>"
8+ )
9+
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.
14+ 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>>"
21+ )
22+ file (GENERATE OUTPUT "${CMAKE_BINARY_DIR} /compile_time_defs.txt" CONTENT "${_compile_definitions} \n " )
23+ set (${definitions_file} @${CMAKE_BINARY_DIR} /compile_time_defs.txt PARENT_SCOPE)
24+ endfunction ()
425# Set the system processor depending on the CPU core type
526if (MBED_CPU_CORE STREQUAL Cortex-A9)
627 set (CMAKE_SYSTEM_PROCESSOR cortex-a9)
Original file line number Diff line number Diff line change @@ -58,28 +58,6 @@ function(mbed_set_toolchain_options target)
5858 )
5959endfunction ()
6060
61- # Generate a file containing compile definitions
62- function (mbed_generate_gcc_options_for_linker target definitions_file)
63- set (_compile_definitions
64- "$<TARGET_PROPERTY:${target} ,COMPILE_DEFINITIONS>"
65- )
66-
67- # Remove macro definitions that contain spaces as the lack of escape sequences and quotation marks
68- # in the macro when retrieved using generator expressions causes linker errors.
69- # This includes string macros, array macros, and macros with operations.
70- # TODO CMake: Add escape sequences and quotation marks where necessary instead of removing these macros.
71- set (_compile_definitions
72- "$<FILTER:${_compile_definitions} ,EXCLUDE, +>"
73- )
74-
75- # Append -D to all macros as we pass these as response file to cxx compiler
76- set (_compile_definitions
77- "$<$<BOOL:${_compile_definitions} >:-D$<JOIN:${_compile_definitions} , -D>>"
78- )
79- file (GENERATE OUTPUT "${CMAKE_BINARY_DIR} /compile_time_defs.txt" CONTENT "${_compile_definitions} \n " )
80- set (${definitions_file} @${CMAKE_BINARY_DIR} /compile_time_defs.txt PARENT_SCOPE)
81- endfunction ()
82-
8361# Configure the toolchain to select the selected C library
8462function (mbed_set_c_lib target lib_type)
8563 if (${lib_type} STREQUAL "small" )
You can’t perform that action at this time.
0 commit comments