File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -453,8 +453,11 @@ include(BubblewrapSandboxChecks)
453453include (GStreamerChecks )
454454
455455# Optimize binary size for release builds by removing dead sections on unix/gcc.
456- if (CMAKE_COMPILER_IS_GNUCC AND UNIX AND NOT APPLE )
457- set (CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -ffunction-sections -fdata-sections" )
458- set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -ffunction-sections -fdata-sections -fno-rtti" )
456+ if (COMPILER_IS_GCC_OR_CLANG AND UNIX AND NOT APPLE )
457+ if (CMAKE_COMPILER_IS_GNUCC)
458+ set (CMAKE_COMPILER_SIZE_OPT_FLAGS " -finline-limit=90 -fsection-anchors" )
459+ endif ()
460+ set (CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}${CMAKE_COMPILER_SIZE_OPT_FLAGS} -ffunction-sections -fdata-sections" )
461+ set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}${CMAKE_COMPILER_SIZE_OPT_FLAGS} -ffunction-sections -fdata-sections -fno-rtti" )
459462 set (CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} -Wl,--gc-sections" )
460463endif ()
You can’t perform that action at this time.
0 commit comments