cmake: safeguard path of SOC_LINKER_SCRIPT

Issue reported on Discord.

Safeguard cmake_path() for SOC_LINKER_SCRIPT so that the path is only
processed when SOC_LINKER_SCRIPT is defined.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
This commit is contained in:
Torsten Rasmussen 2023-11-03 14:55:25 +01:00 committed by Fabio Baltieri
parent 8ba8c188a0
commit 0b0f2f1912

View file

@ -57,7 +57,10 @@ macro(configure_linker_script linker_script_gen linker_pass_define)
zephyr_get_include_directories_for_lang(C current_includes) zephyr_get_include_directories_for_lang(C current_includes)
get_property(current_defines GLOBAL PROPERTY PROPERTY_LINKER_SCRIPT_DEFINES) get_property(current_defines GLOBAL PROPERTY PROPERTY_LINKER_SCRIPT_DEFINES)
cmake_path(GET SOC_LINKER_SCRIPT PARENT_PATH soc_linker_script_includes) if(DEFINED SOC_LINKER_SCRIPT)
cmake_path(GET SOC_LINKER_SCRIPT PARENT_PATH soc_linker_script_includes)
set(soc_linker_script_includes -I${soc_linker_script_includes})
endif()
add_custom_command( add_custom_command(
OUTPUT ${linker_script_gen} OUTPUT ${linker_script_gen}
@ -75,7 +78,7 @@ macro(configure_linker_script linker_script_gen linker_pass_define)
-D_ASMLANGUAGE -D_ASMLANGUAGE
-imacros ${AUTOCONF_H} -imacros ${AUTOCONF_H}
${current_includes} ${current_includes}
-I${soc_linker_script_includes} ${soc_linker_script_includes}
${current_defines} ${current_defines}
${template_script_defines} ${template_script_defines}
-E ${LINKER_SCRIPT} -E ${LINKER_SCRIPT}