From f91431465b910b1acfc352d2425310beb34b7598 Mon Sep 17 00:00:00 2001 From: Yaroslav Date: Fri, 17 May 2024 15:06:31 +0500 Subject: cmake: make gprof optional for debug builds (#6120) This fixes the debug build on musl systems, as -pg option is specific to glibc. Now we can build the project on such systems with -DUSE_GPROF=OFF --- CMakeLists.txt | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index b30591d9..43927fbe 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -126,6 +126,8 @@ endif() add_executable(Hyprland ${SRCFILES} ${TRACY_CPP_FILES}) add_dependencies(Hyprland wlroots-hyprland) +set(USE_GPROF ON) + if(CMAKE_BUILD_TYPE MATCHES Debug OR CMAKE_BUILD_TYPE MATCHES DEBUG) message(STATUS "Setting debug flags") @@ -151,8 +153,12 @@ if(CMAKE_BUILD_TYPE MATCHES Debug OR CMAKE_BUILD_TYPE MATCHES DEBUG) endif() endif() - add_compile_options(-pg -no-pie -fno-builtin) - add_link_options(-pg -no-pie -fno-builtin) + add_compile_options(-fno-pie -fno-builtin) + add_link_options(-no-pie -fno-builtin) + if(USE_GPROF) + add_compile_options(-pg) + add_link_options(-pg) + endif() endif() check_include_file("execinfo.h" EXECINFOH) -- cgit v1.2.3