summaryrefslogtreecommitdiff
path: root/lib/CMakeLists.txt
diff options
context:
space:
mode:
authorTobias Hieta <tobias@plex.tv>2020-01-09 12:10:55 +0100
committerDaniel Stenberg <daniel@haxx.se>2020-01-13 23:14:49 +0100
commit4ccf7622db04af58442c460b8091b952585de5c7 (patch)
tree7451edcf604d1703661c28eea1238ef73402ef72 /lib/CMakeLists.txt
parentf128c00a99ffb7482740f3579f42f5e026a1ee74 (diff)
downloadcurl-4ccf7622db04af58442c460b8091b952585de5c7.tar.gz
CMake: Add support for CMAKE_LTO option.
This enables Link Time Optimization. LTO is a proven technique for optimizing across compilation units. Closes #4799
Diffstat (limited to 'lib/CMakeLists.txt')
-rw-r--r--lib/CMakeLists.txt6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt
index a9c90b665..e73efb90a 100644
--- a/lib/CMakeLists.txt
+++ b/lib/CMakeLists.txt
@@ -96,6 +96,12 @@ endif()
set_target_properties(${LIB_NAME} PROPERTIES PREFIX "")
set_target_properties(${LIB_NAME} PROPERTIES IMPORT_PREFIX "")
+if(CURL_HAS_LTO)
+ set_target_properties(${LIB_NAME} PROPERTIES
+ INTERPROCEDURAL_OPTIMIZATION_RELEASE TRUE
+ INTERPROCEDURAL_OPTIMIZATION_RELWITHDEBINFO TRUE)
+endif()
+
if(WIN32)
if(BUILD_SHARED_LIBS)
# Add "_imp" as a suffix before the extension to avoid conflicting with the statically linked "libcurl.lib"