diff --git a/firmware/application/CMakeLists.txt b/firmware/application/CMakeLists.txt index 988f5bcd0..575c50322 100644 --- a/firmware/application/CMakeLists.txt +++ b/firmware/application/CMakeLists.txt @@ -44,7 +44,7 @@ if(cpp20_supported) else() set(USE_CPPOPT "-std=c++17") endif() -set(USE_CPPOPT "${USE_CPPOPT} -flto -fno-rtti -fno-exceptions -Weffc++ -Wuninitialized -Wno-volatile") +set(USE_CPPOPT "${USE_CPPOPT} -fno-rtti -fno-exceptions -Weffc++ -Wuninitialized -Wno-volatile") # Enable this if you want the linker to remove unused code and data set(USE_LINK_GC yes) @@ -347,10 +347,12 @@ set(CPPSRC ${HACKRF_CPLD_DATA_CPP} ui_external_items_menu_loader.cpp view_factory_base.cpp - - ${EXTCPPSRC} ) +set_source_files_properties(${CPPSRC} PROPERTIES COMPILE_FLAGS -flto) # Add lto flag to the non-external sources only + +list (APPEND CPPSRC ${EXTCPPSRC}) # Append external sources after setting lto flag to internal ones + # C sources to be compiled in ARM mode regardless of the global setting. # NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler # option that results in lower performance and larger code size. @@ -492,7 +494,6 @@ add_custom_command( ) add_executable(${PROJECT_NAME}.elf ${CSRC} ${CPPSRC} ${ASMSRC}) -set_source_files_properties(${EXTCPPSRC} PROPERTIES COMPILE_FLAGS -fno-lto) set_target_properties(${PROJECT_NAME}.elf PROPERTIES LINK_DEPENDS ${LDSCRIPT}) add_definitions(${DEFS}) include_directories(. ${INCDIR})