endif()
+if (CMAKE_BUILD_TYPE_UC MATCHES "RELEASE|RELWITHDEBINFO")
+ set(ENABLE_LTO_INIT ON)
+else()
+ set(ENABLE_LTO_INIT OFF)
+endif()
+option(ENABLE_LTO "Build rspamd with Link Time Optimization if supported [default: ${ENABLE_LTO_INIT}]" ${ENABLE_LTO_INIT})
+
if (CMAKE_BUILD_TYPE_UC MATCHES "COVERAGE")
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --coverage")
-elseif (CMAKE_BUILD_TYPE_UC MATCHES "RELEASE")
+elseif (ENABLE_LTO)
if (${CMAKE_VERSION} VERSION_GREATER "3.9.0")
cmake_policy (SET CMP0069 NEW)
include (CheckIPOSupported)
endif ()
message (STATUS "Final CFLAGS: ${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_${CMAKE_BUILD_TYPE_UC}}")
-message (STATUS "Final CXXFLAGS: ${CMAKE_CXX_FLAGS} ${CMAKE_C_FLAGS_${CMAKE_BUILD_TYPE_UC}}")
\ No newline at end of file
+message (STATUS "Final CXXFLAGS: ${CMAKE_CXX_FLAGS} ${CMAKE_C_FLAGS_${CMAKE_BUILD_TYPE_UC}}")
-DLIBDIR=/usr/lib/rspamd \
-DINCLUDEDIR=/usr/include \
-DSYSTEMDDIR=/lib/systemd/system \
- -DCMAKE_BUILD_TYPE=ReleaseWithDebInfo \
+ -DCMAKE_BUILD_TYPE=None \
-DCMAKE_BUILD_WITH_INSTALL_RPATH=ON \
+ -DENABLE_LTO=ON \
-DDEBIAN_BUILD=1 \
-DENABLE_JEMALLOC=ON \
-DENABLE_PCRE2=OFF \