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
This commit is contained in:
Yaroslav 2024-05-17 15:06:31 +05:00 committed by GitHub
parent a66cfe0fbe
commit f91431465b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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)