cmake: ld: Ensure that a linker script change triggers a rebuild
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 <sebastian.boe@nordicsemi.no>
This commit is contained in:
parent
5d25497f90
commit
b1ab5018ba
1 changed files with 19 additions and 1 deletions
|
@ -568,7 +568,20 @@ add_custom_target(
|
||||||
DEPENDS
|
DEPENDS
|
||||||
linker.cmd
|
linker.cmd
|
||||||
offsets_h
|
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)
|
get_property(E_KERNEL_ENTRY GLOBAL PROPERTY E_KERNEL_ENTRY)
|
||||||
|
|
||||||
|
@ -757,6 +770,11 @@ if(GKOF OR GKSF)
|
||||||
linker_pass2.cmd
|
linker_pass2.cmd
|
||||||
offsets_h
|
offsets_h
|
||||||
)
|
)
|
||||||
|
set_property(TARGET
|
||||||
|
linker_pass2_script
|
||||||
|
PROPERTY INCLUDE_DIRECTORIES
|
||||||
|
${ZEPHYR_INCLUDE_DIRS}
|
||||||
|
)
|
||||||
|
|
||||||
add_executable( kernel_elf misc/empty_file.c ${GKSF})
|
add_executable( kernel_elf misc/empty_file.c ${GKSF})
|
||||||
target_link_libraries(kernel_elf ${GKOF} ${TOPT} ${PROJECT_BINARY_DIR}/linker_pass2.cmd ${zephyr_lnk})
|
target_link_libraries(kernel_elf ${GKOF} ${TOPT} ${PROJECT_BINARY_DIR}/linker_pass2.cmd ${zephyr_lnk})
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue