From 950dd213c80f6a8624ff6910e9791c58eabba7e6 Mon Sep 17 00:00:00 2001 From: Eyck-Alexander Jentzsch Date: Sat, 21 Mar 2026 15:10:45 +0100 Subject: [PATCH] makes setup_target function more robust when being called in other CMakeLists.txt files --- CMakeLists.txt | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index eabe543..91f75a2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -47,22 +47,22 @@ function(setup_target TARGET) add_executable(${TARGET}) target_sources(${TARGET} PRIVATE - port/picolibc/port.c - port/moonlight/bootup.c - port/moonlight/board.c - port/moonlight/trap_non_vectored.c - port/moonlight/exception.c - port/moonlight/vector_table.c + ${CMAKE_SOURCE_DIR}/port/picolibc/port.c + ${CMAKE_SOURCE_DIR}/port/moonlight/bootup.c + ${CMAKE_SOURCE_DIR}/port/moonlight/board.c + ${CMAKE_SOURCE_DIR}/port/moonlight/trap_non_vectored.c + ${CMAKE_SOURCE_DIR}/port/moonlight/exception.c + ${CMAKE_SOURCE_DIR}/port/moonlight/vector_table.c ) if("netxduo" IN_LIST ST_LIBRARIES) - target_sources(${TARGET} PRIVATE port/moonlight/mnrs_network_driver.c) + target_sources(${TARGET} PRIVATE ${CMAKE_SOURCE_DIR}/port/moonlight/mnrs_network_driver.c) endif() if(ST_SOURCES) target_sources(${TARGET} PRIVATE ${ST_SOURCES}) endif() - target_include_directories(${TARGET} PRIVATE port/moonlight src) + target_include_directories(${TARGET} PRIVATE ${CMAKE_SOURCE_DIR}/port/moonlight ${CMAKE_SOURCE_DIR}/src) target_compile_options(${TARGET} PRIVATE -ffreestanding -fno-builtin @@ -72,7 +72,7 @@ function(setup_target TARGET) if(NX_DEBUG) target_compile_definitions(${TARGET} PRIVATE NX_DEBUG NX_DEBUG_PACKET) endif() - target_link_directories(${TARGET} PRIVATE src) # needed for linker script includes + target_link_directories(${TARGET} PRIVATE ${CMAKE_SOURCE_DIR}/src) # needed for linker script includes target_link_options(${TARGET} PRIVATE -nostartfiles -nostdlib