From bc08e801c6b1416dcbbc679f5e25f801d438a531 Mon Sep 17 00:00:00 2001 From: Alberto Escolar Piedras Date: Tue, 14 Nov 2023 15:23:55 +0100 Subject: [PATCH] native_sim build: Fix for APPLICATION_BINARY_DIR!=CMAKE_BINARY_DIR In some cases, the APPLICATION_BINARY_DIR does not match the CMAKE_BINARY_DIR, in those cases the native simulator build would not find the zephyr elf file. Fix it by using the correct variable. Signed-off-by: Alberto Escolar Piedras --- CMakeLists.txt | 2 +- boards/posix/common/natsim_config.cmake | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c29fa6885a4..164d82fde0e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1762,7 +1762,7 @@ if(CONFIG_BUILD_OUTPUT_EXE) COMMENT "Building native simulator runner, and linking final executable" COMMAND ${MAKE} -f ${ZEPHYR_BASE}/scripts/native_simulator/Makefile all --warn-undefined-variables - -r NSI_CONFIG_FILE=${CMAKE_BINARY_DIR}/zephyr/NSI/nsi_config + -r NSI_CONFIG_FILE=${APPLICATION_BINARY_DIR}/zephyr/NSI/nsi_config # nsi_config is created by the board cmake file DEPENDS ${logical_target_for_zephyr_elf} BYPRODUCTS ${KERNEL_EXE_NAME} diff --git a/boards/posix/common/natsim_config.cmake b/boards/posix/common/natsim_config.cmake index 576e4b9b637..2ab155af105 100644 --- a/boards/posix/common/natsim_config.cmake +++ b/boards/posix/common/natsim_config.cmake @@ -1,7 +1,7 @@ # Copyright (c) 2023 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 -set(zephyr_build_path ${CMAKE_BINARY_DIR}/zephyr) +set(zephyr_build_path ${APPLICATION_BINARY_DIR}/zephyr) get_property(CCACHE GLOBAL PROPERTY RULE_LAUNCH_COMPILE) target_link_options(native_simulator INTERFACE