diff --git a/miosix/CMakeLists.txt b/miosix/CMakeLists.txt
index bdbc7cae32ff4681c19dc71789b2b524ba1a005e..2ac14597f55168bdd9727cfe13f596b5203e4cef 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 5b3e36d92e0823704af2d534beb3a8fdd2a4beb9..1e89edab33267cd66157993d16ced1c3a0e5b92a 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()