From f4107bdbed6cffed92ec2ac419ab6baf8a386d57 Mon Sep 17 00:00:00 2001 From: Graeme Gott Date: Sun, 19 Jun 2022 13:01:06 -0400 Subject: [PATCH] Add options to CMakeLists.txt for optimizing build --- CMakeLists.txt | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1573fdec..dd6d08b6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -160,6 +160,24 @@ elseif(WIN32) ) endif() +# Optimize build +option(ENABLE_LINK_TIME_OPTIMIZATION "Enable link time optimization" OFF) +if(ENABLE_LINK_TIME_OPTIMIZATION) + include(CheckIPOSupported) + check_ipo_supported(RESULT result) + if(result) + set_target_properties(focuswriter PROPERTIES INTERPROCEDURAL_OPTIMIZATION TRUE) + endif() +endif() + +option(ENABLE_STRIP "Enable automatic stripping of release builds" OFF) +if(ENABLE_STRIP) + add_custom_command(TARGET focuswriter + POST_BUILD + COMMAND ${CMAKE_STRIP} $ + ) +endif() + # Create symbols add_subdirectory(resources/symbols)