From b1ab5018ba092e6f05065629f7da95964840aca5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20B=C3=B8e?= Date: Thu, 14 Dec 2017 13:03:23 +0100 Subject: [PATCH] cmake: ld: Ensure that a linker script change triggers a rebuild MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This fixes https://github.com/zephyrproject-rtos/zephyr/issues/5010. CMake has a simple parser that can parse C-like files to find header dependencies. But the parser needs to know what the include directories are to be able to follow #include pragmas. Signed-off-by: Sebastian Bøe --- CMakeLists.txt | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 69618aed8cd..ee133737f6e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -568,7 +568,20 @@ add_custom_target( DEPENDS linker.cmd offsets_h -) + ) + +# Give the 'linker_script' target all of the include directories so +# that cmake can successfully find the linker_script's header +# dependencies. +zephyr_get_include_directories_for_lang(C + ZEPHYR_INCLUDE_DIRS + STRIP_PREFIX # Don't use a -I prefix + ) +set_property(TARGET + linker_script + PROPERTY INCLUDE_DIRECTORIES + ${ZEPHYR_INCLUDE_DIRS} + ) get_property(E_KERNEL_ENTRY GLOBAL PROPERTY E_KERNEL_ENTRY) @@ -757,6 +770,11 @@ if(GKOF OR GKSF) linker_pass2.cmd offsets_h ) + set_property(TARGET + linker_pass2_script + PROPERTY INCLUDE_DIRECTORIES + ${ZEPHYR_INCLUDE_DIRS} + ) add_executable( kernel_elf misc/empty_file.c ${GKSF}) target_link_libraries(kernel_elf ${GKOF} ${TOPT} ${PROJECT_BINARY_DIR}/linker_pass2.cmd ${zephyr_lnk})