From fbcea17c860d149c39bb5bfa841b612affa6b3ac Mon Sep 17 00:00:00 2001 From: Mark Ruvald Pedersen Date: Mon, 29 Apr 2019 20:35:12 +0200 Subject: [PATCH] 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 --- CMakeLists.txt | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f104dfe0b96..9846b57d3ec 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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}