CMake: Add support for CMAKE_LTO option.

This enables Link Time Optimization. LTO is a proven technique for
optimizing across compilation units.

Closes #4799
This commit is contained in:
Tobias Hieta 2020-01-09 12:10:55 +01:00 committed by Daniel Stenberg
parent f128c00a99
commit 4ccf7622db
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
3 changed files with 30 additions and 0 deletions

View file

@ -46,6 +46,12 @@ add_executable(
${CURL_FILES}
)
if(CURL_HAS_LTO)
set_target_properties(${EXE_NAME} PROPERTIES
INTERPROCEDURAL_OPTIMIZATION_RELEASE TRUE
INTERPROCEDURAL_OPTIMIZATION_RELWITHDEBINFO TRUE)
endif()
source_group("curlX source files" FILES ${CURLX_CFILES})
source_group("curl source files" FILES ${CURL_CFILES})
source_group("curl header files" FILES ${CURL_HFILES})