Enable LTO support for Chatterino builds (#4258)

This is disabled by default, and can be enabled by passing `-DCHATTERINO_LTO=On` to your cmake invocation.
This commit is contained in:
pajlada
2022-12-24 18:42:59 +01:00
committed by GitHub
parent 621134ffcb
commit 83dfb08aed
5 changed files with 50 additions and 4 deletions
+6
View File
@@ -46,6 +46,12 @@ set_target_properties(${PROJECT_NAME}
RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO "${CMAKE_BINARY_DIR}/bin"
)
if(CHATTERINO_ENABLE_LTO)
message(STATUS "Enabling LTO for ${PROJECT_NAME}")
set_property(TARGET ${PROJECT_NAME}
PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE)
endif()
# gtest_add_tests manages to discover the tests because it looks through the source files
# HOWEVER, it fails to run, because we have some bug that causes the QApplication exit to stall when no network requests have been made.
# ctest runs each test individually, so for now we require that testers just run the ./bin/chatterino-test binary without any filters applied