add option to enable link time optimization

a bit slower to compile for developing so defaults to 'false', but
might be a good idea for the releases.
This commit is contained in:
Marco Antonio J. Costa
2024-12-27 18:17:20 -03:00
committed by majcosta
parent dc72a43a19
commit a83dfbefb0
+8
View File
@@ -9,6 +9,14 @@ set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
include(CheckIPOSupported)
check_ipo_supported(RESULT LinkTimeOptimization OUTPUT IpoError LANGUAGES C CXX)
if(LinkTimeOptimization)
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)
else()
message(WARNING "IPO is not supported: ${IpoError}")
endif()
option(ADDRESS_SANITIZER OFF)
if(ADDRESS_SANITIZER)
message(STATUS "AddressSanitizer ENABLED for non-Release builds")