Skip to content

Commit

Permalink
Merge pull request #26 from gmbeard/feature/enable-lto
Browse files Browse the repository at this point in the history
feat(build) Enables LTO
  • Loading branch information
gmbeard authored Nov 28, 2023
2 parents 7fedac1 + 06951a6 commit 92b09ab
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions .versioning/changes/qz3SfuZKgk.minor.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Enables LTO when supported by compiler/linker
13 changes: 13 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,19 @@ set(CMAKE_CXX_STANDARD 20)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/cmake)
include(CPPCheck)
include(GNUInstallDirs)
include(CheckIPOSupported)
check_ipo_supported(
RESULT SHADOW_CAST_IPO_SUPPORTED
OUTPUT SHADOW_CAST_IPO_SUPORTED_OUTPUT
LANGUAGES CXX
)

if (SHADOW_CAST_IPO_SUPPORTED)
message(STATUS "IPO supported. Enabling")
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION ON)
else ()
message(STATUS "IPO not supported: ${SHADOW_CAST_IPO_SUPORTED_OUTPUT}")
endif ()

string(TOLOWER ${CMAKE_CXX_BYTE_ORDER} SHADOW_CAST_BYTE_ORDER)

Expand Down

0 comments on commit 92b09ab

Please sign in to comment.