From b80361ad84cb242094d214ce411eb401e76b040b Mon Sep 17 00:00:00 2001 From: Nir Azkiel Date: Fri, 28 Oct 2022 09:04:02 +0300 Subject: [PATCH] add no-lto flag --- common/fw/CMakeLists.txt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/common/fw/CMakeLists.txt b/common/fw/CMakeLists.txt index 5bd018dce6..b29d9d6881 100644 --- a/common/fw/CMakeLists.txt +++ b/common/fw/CMakeLists.txt @@ -44,6 +44,13 @@ set(L53X_FW_URL "${REALSENSE_FIRMWARE_URL}/Releases/L5xx/FW") add_library(${PROJECT_NAME} STATIC empty.c) +# disable link time optimization for fw by adding -fno-lto to disable -flto flag +# jammy debian has build errors without it +if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + message(STATUS "disable link time optimization for fw project") + target_compile_options(${PROJECT_NAME} PRIVATE -fno-lto) +endif() + if (MSVC) # lib.exe can't handle multiple .res files, so include them in one. # even then, the linker won't grab a .res out of a .lib object, so it needs to be explicitly listed