cmake: simplify configure_linker_script: avoid deriving define from name

Rather than associating defines within the function, let the call sites
themselves pick the appropriate define. Add new argument for this.
This also permits us to remove regex matching.

No functional change expected.

Signed-off-by: Mark Ruvald Pedersen <mped@oticon.com>
This commit is contained in:
Mark Ruvald Pedersen 2019-04-29 20:35:12 +02:00 committed by Alberto Escolar
parent 1073fbaa00
commit fbcea17c86

View file

@ -409,17 +409,9 @@ endif()
configure_file(version.h.in ${PROJECT_BINARY_DIR}/include/generated/version.h)
# Run $LINKER_SCRIPT file through the C preprocessor, producing ${linker_script_gen}
macro(configure_linker_script linker_script_gen)
macro(configure_linker_script linker_script_gen linker_pass_define)
set(extra_dependencies ${ARGN})
if (${linker_script_gen} MATCHES "^linker_pass_final.cmd$")
set(linker_pass_define -DLINKER_PASS2)
elseif (${linker_script_gen} MATCHES "^linker_app_smem_unaligned.cmd$")
set(linker_pass_define -DLINKER_APP_SMEM_UNALIGNED)
else()
set(linker_pass_define "")
endif()
# Different generators deal with depfiles differently.
if(CMAKE_GENERATOR STREQUAL "Unix Makefiles")
# Note that the IMPLICIT_DEPENDS option is currently supported only
@ -731,6 +723,7 @@ endif() # CONFIG_CODE_DATA_RELOCATION
configure_linker_script(
linker.cmd
""
${PRIV_STACK_DEP}
${APP_SMEM_ALIGNED_DEP}
${CODE_RELOCATION_DEP}
@ -1159,6 +1152,7 @@ if(CONFIG_USERSPACE)
configure_linker_script(
linker_app_smem_unaligned.cmd
"-DLINKER_APP_SMEM_UNALIGNED"
${CODE_RELOCATION_DEP}
${APP_SMEM_UNALIGNED_DEP}
${APP_SMEM_UNALIGNED_LD}
@ -1203,6 +1197,7 @@ endif()
if(CONFIG_USERSPACE AND CONFIG_ARM)
configure_linker_script(
linker_priv_stacks.cmd
""
${CODE_RELOCATION_DEP}
${APP_SMEM_ALIGNED_DEP}
${APP_SMEM_ALIGNED_LD}
@ -1249,6 +1244,7 @@ else()
# file and preprocessed with the define LINKER_PASS2.
configure_linker_script(
linker_pass_final.cmd
"-DLINKER_PASS2"
${PRIV_STACK_DEP}
${CODE_RELOCATION_DEP}
${ZEPHYR_PREBUILT_EXECUTABLE}