From 12840bc5a26610905ac8ee0f6b3e3256bb4713bb Mon Sep 17 00:00:00 2001
From: Emilio Corigliano <emilio.corigliano@skywarder.eu>
Date: Tue, 21 Jan 2025 14:22:46 +0100
Subject: [PATCH] [Build System] Updated BS to support ASPIS

---
 miosix/CMakeLists.txt         |  1 +
 miosix/cmake/LinkTarget.cmake | 30 +++++++++++++++---------------
 2 files changed, 16 insertions(+), 15 deletions(-)

diff --git a/miosix/CMakeLists.txt b/miosix/CMakeLists.txt
index bdbc7cae..2ac14597 100644
--- a/miosix/CMakeLists.txt
+++ b/miosix/CMakeLists.txt
@@ -135,6 +135,7 @@ target_compile_definitions(miosix PRIVATE $<$<COMPILE_LANGUAGE:C,CXX>:COMPILING_
 
 # Configure linker file and options needed to link agains this library
 set_property(TARGET miosix PROPERTY LINK_DEPENDS ${MIOSIX_BOARD_INC}/${MIOSIX_LINKER_SCRIPT})
+set_property(TARGET miosix PROPERTY TARGET_CXX_FLAGS ${MIOSIX_CXX_FLAGS} ${MIOSIX_L_FLAGS})
 target_link_options(miosix INTERFACE ${MIOSIX_L_FLAGS})
 
 # Run the kernel_global_objects.pl script on all kernel objects
diff --git a/miosix/cmake/LinkTarget.cmake b/miosix/cmake/LinkTarget.cmake
index 5b3e36d9..1e89edab 100644
--- a/miosix/cmake/LinkTarget.cmake
+++ b/miosix/cmake/LinkTarget.cmake
@@ -56,22 +56,22 @@ function(miosix_link_target TARGET TYPE)
     get_target_property(target_type ${TARGET} TYPE)
     if (target_type STREQUAL "EXECUTABLE")
         # Add a post build command to create the hex file to flash on the board
-        add_custom_command(
-            OUTPUT ${TARGET}.hex
-            COMMAND ${CMAKE_OBJCOPY} -O ihex $<TARGET_FILE:${TARGET}> ${TARGET}.hex
-            COMMENT "Creating ${TARGET}.hex"
-            VERBATIM
-        )
-        add_custom_target(${TARGET}_hex ALL DEPENDS ${TARGET}.hex)
-        add_custom_command(
-            OUTPUT ${TARGET}.bin
-            COMMAND ${CMAKE_OBJCOPY} -O binary $<TARGET_FILE:${TARGET}> ${TARGET}.bin
-            COMMENT "Creating ${TARGET}.bin"
-            VERBATIM
-        )
-        add_custom_target(${TARGET}_bin ALL DEPENDS ${TARGET}.bin)
+        #add_custom_command(
+        #    OUTPUT ${TARGET}.hex
+        #    COMMAND ${CMAKE_OBJCOPY} -O ihex $<TARGET_FILE:${TARGET}> ${TARGET}.hex
+        #    COMMENT "Creating ${TARGET}.hex"
+        #    VERBATIM
+        #)
+        #add_custom_target(${TARGET}_hex ALL DEPENDS ${TARGET}.hex)
+        #add_custom_command(
+        #    OUTPUT ${TARGET}.bin
+        #    COMMAND ${CMAKE_OBJCOPY} -O binary $<TARGET_FILE:${TARGET}> ${TARGET}.bin
+        #    COMMENT "Creating ${TARGET}.bin"
+        #    VERBATIM
+        #)
+        #add_custom_target(${TARGET}_bin ALL DEPENDS ${TARGET}.bin)
     endif ()
 
     # Generate custom build command to flash the target
-    miosix_add_program_target(${TARGET})
+    # miosix_add_program_target(${TARGET})
 endfunction()
-- 
GitLab