Skip to content
Browse files

CMakeLists.txt: fix misleading logical_target_for_zephyr_elf comment

The comment for:

  set_target_properties(${logical_target_for_zephyr_elf} PROPERTIES

was completely off-topic and making something relatively simple
incredibly puzzling and time-consuming to understand.

Re-order the if(GKSF OR GKOF) clauses so the two initializations of
logical_target_for_zephyr_elf are close to each other and so the very
short clause is not buried at the bottom of the long one.

Other minor logical_target_for_zephyr_elf comment fixes.

Signed-off-by: Marc Herbert <>
  • Loading branch information...
marc-hb authored and galak committed Apr 17, 2019
1 parent d6d7a80 commit 498b49469a6ca56eeaaa7d403ee8350bb9e71e3d
Showing with 14 additions and 8 deletions.
  1. +14 −8 CMakeLists.txt

set(generated_kernel_files ${GKSF} ${GKOF})
if(NOT generated_kernel_files)
# Use the prebuilt elf as the final elf since we don't have a
# generation stage.
set(logical_target_for_zephyr_elf ${ZEPHYR_PREBUILT_EXECUTABLE})
set(KERNEL_ELF kernel_elf)
set(logical_target_for_zephyr_elf ${KERNEL_ELF})

@@ -1334,18 +1339,16 @@ if(GKOF OR GKSF)
target_link_libraries(${KERNEL_ELF} ${GKOF} ${TOPT} ${PROJECT_BINARY_DIR}/linker_pass_final.cmd ${zephyr_lnk} ${CODE_RELOCATION_DEP})
set_property(TARGET ${KERNEL_ELF} PROPERTY LINK_DEPENDS ${PROJECT_BINARY_DIR}/linker_pass_final.cmd)
set(logical_target_for_zephyr_elf ${ZEPHYR_PREBUILT_EXECUTABLE})
# Use the prebuilt elf as the final elf since we don't have a
# generation stage.

# Export the variable to the application's scope to allow the
# application to know what the name of the final elf target is.
set(logical_target_for_zephyr_elf ${logical_target_for_zephyr_elf} PARENT_SCOPE)

# To avoid having the same logical target name for the zephyr lib and
# the zephyr elf, we set the kernel_elf file name to zephyr.elf.
# Override the base name of final .elf so:
# 1. it doesn't depend on the number of passes above and the
# post_build_commands below can always find it no matter which is it;
# 2. it can be defined in Kconfig
set_target_properties(${logical_target_for_zephyr_elf} PROPERTIES OUTPUT_NAME ${KERNEL_NAME})

set(post_build_commands "")
@@ -1412,11 +1415,14 @@ list(APPEND

# Add post_build_commands to post-process the final .elf file produced by
# either the ZEPHYR_PREBUILT_EXECUTABLE or the KERNEL_ELF executable
# targets above.
TARGET ${logical_target_for_zephyr_elf}
COMMENT "Generating files from zephyr.elf for board: ${BOARD}"
COMMENT "Generating files from ${KERNEL_ELF_NAME} for board: ${BOARD}"
# NB: COMMENT only works for some CMake-Generators

0 comments on commit 498b494

Please sign in to comment.
You can’t perform that action at this time.