Skip to content

Commit 7ad928d

Browse files
committed
CMake(Linux): make "-fno-omit-frame-pointer" configurable in release mode
1 parent d897472 commit 7ad928d

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ option(SET_TWEAK "Add tweak to project version" ON) # This is set to off by gith
9191
option(IS_MUSL "Build with musl libc" OFF) # Used by Github Actions
9292
option(INSTALL_LICENSE "Install license into /usr/share/licenses" ON)
9393
option(ENABLE_EMBEDDED_PCIIDS "Embed pci.ids into fastfetch, requires `python`" OFF)
94+
option(ENABLE_FRAME_POINTERS "Build fastfetch with frame pointers" OFF) # For Fedora/Ubuntu/Arch Linux packagers
9495

9596
set(BINARY_LINK_TYPE_OPTIONS dlopen dynamic static)
9697
set(BINARY_LINK_TYPE dlopen CACHE STRING "How to link fastfetch")
@@ -138,6 +139,10 @@ set(WARNING_FLAGS "-Wall -Wextra -Wconversion -Werror=uninitialized -Werror=retu
138139
set(CMAKE_C_STANDARD 11)
139140
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${WARNING_FLAGS} -Werror=incompatible-pointer-types -Werror=implicit-function-declaration -Werror=int-conversion")
140141

142+
if(LINUX AND ENABLE_FRAME_POINTERS AND NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
143+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer")
144+
endif()
145+
141146
if(WIN32 OR ENABLE_DIRECTX_HEADERS)
142147
enable_language(CXX)
143148
set(CMAKE_CXX_STANDARD 17)

0 commit comments

Comments
 (0)