File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -475,8 +475,11 @@ include(BubblewrapSandboxChecks)
475475include (GStreamerChecks )
476476
477477# Optimize binary size for release builds by removing dead sections on unix/gcc.
478- if (CMAKE_COMPILER_IS_GNUCC AND UNIX AND NOT APPLE )
479- set (CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -ffunction-sections -fdata-sections" )
480- set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -ffunction-sections -fdata-sections -fno-rtti" )
478+ if (COMPILER_IS_GCC_OR_CLANG AND UNIX AND NOT APPLE )
479+ if (CMAKE_COMPILER_IS_GNUCC)
480+ set (CMAKE_COMPILER_SIZE_OPT_FLAGS " -finline-limit=90 -fsection-anchors" )
481+ endif ()
482+ set (CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}${CMAKE_COMPILER_SIZE_OPT_FLAGS} -ffunction-sections -fdata-sections" )
483+ set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}${CMAKE_COMPILER_SIZE_OPT_FLAGS} -ffunction-sections -fdata-sections -fno-rtti" )
481484 set (CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} -Wl,--gc-sections" )
482485endif ()
You can’t perform that action at this time.
0 commit comments