From 7b6666a2a38e6e861d7f40dcf9b25a8c14dbb91b Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Wed, 8 Jan 2025 08:12:10 +0000 Subject: [PATCH] cmake: Configure custom linker script Kconfig before usage Allows having CMake variables inside of this Kconfig to e.g. use a value that can specify a board directory or path relative to a CMake file location variable Signed-off-by: Jamie McCrae --- CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5bd9348cb57e88..c2b73040bc4d99 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1109,10 +1109,10 @@ set_ifndef( TOPT "${COMPILER_TOPT}") set_ifndef( TOPT -Wl,-T) # Use this if the compiler driver doesn't set a value if(CONFIG_HAVE_CUSTOM_LINKER_SCRIPT) - set(LINKER_SCRIPT ${APPLICATION_SOURCE_DIR}/${CONFIG_CUSTOM_LINKER_SCRIPT}) + string(CONFIGURE ${APPLICATION_SOURCE_DIR}/${CONFIG_CUSTOM_LINKER_SCRIPT} LINKER_SCRIPT) if(NOT EXISTS ${LINKER_SCRIPT}) - set(LINKER_SCRIPT ${CONFIG_CUSTOM_LINKER_SCRIPT}) - assert_exists(CONFIG_CUSTOM_LINKER_SCRIPT) + string(CONFIGURE ${CONFIG_CUSTOM_LINKER_SCRIPT} LINKER_SCRIPT) + assert_exists(LINKER_SCRIPT) endif() elseif(DEFINED BOARD_LINKER_SCRIPT) set(LINKER_SCRIPT ${BOARD_LINKER_SCRIPT})