Skip to content

Commit

Permalink
Enable LTO in supported compilers for CMake
Browse files Browse the repository at this point in the history
  • Loading branch information
In-line committed May 5, 2024
1 parent 589f758 commit efd0a86
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,17 @@ if(CMAKE_BUILD_TYPE MATCHES Debug OR CMAKE_BUILD_TYPE MATCHES DEBUG)
else()
add_compile_options(-O3)
message(STATUS "Configuring Hyprland in Release with CMake")

include(CheckIPOSupported)
check_ipo_supported(RESULT IPO_SUPPORTED OUTPUT IPO_ERROR LANGUAGES C CXX)

if(IPO_SUPPORTED)
message(STATUS "IPO / LTO enabled")
else()
message(WARNING "IPO / LTO not supported: <${IPO_ERROR}>")
endif()

set(CMAKE_INTERPROCEDURAL_OPTIMIZATION ${IPO_SUPPORTED})
endif()

include_directories(
Expand Down

0 comments on commit efd0a86

Please sign in to comment.