summaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
authorJoerg Bornemann <joerg.bornemann@qt.io>2020-08-27 14:11:00 +0200
committerJoerg Bornemann <joerg.bornemann@qt.io>2020-09-11 11:30:56 +0200
commit96bdcdacbc09b1f3091a39b83fe394af1ccb41ea (patch)
treeccca51911ad88c3cb05a9205e30201e53c57733d /cmake
parent756c65d3676d2b3ce5c7b56145e5f0f7cf7178ad (diff)
CMake: Implement configure -ltcg
This configure switch sets the CMake variable CMAKE_INTERPROCEDURAL_OPTIMIZATION_<CONFIG> per release config to ON. The feature 'ltcg' is enabled if any of the variables CMAKE_INTERPROCEDURAL_OPTIMIZATION, CMAKE_INTERPROCEDURAL_OPTIMIZATION_<CONFIG> are ON. In order to implement the check, configurejson2cmake had to be extended to be able to write extra CMake code before and after the feature definition. This extra code can be added to a feature mapping below the keys "cmakePrelude" and "cmakeEpilogue". Task-number: QTBUG-85373 Change-Id: Ia2eb907edcf087f137977a9b090705397f83eb05 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Diffstat (limited to 'cmake')
-rw-r--r--cmake/QtProcessConfigureArgs.cmake10
-rw-r--r--cmake/configure-cmake-mapping.md3
2 files changed, 12 insertions, 1 deletions
diff --git a/cmake/QtProcessConfigureArgs.cmake b/cmake/QtProcessConfigureArgs.cmake
index b4fc1792c5..8a620ba31c 100644
--- a/cmake/QtProcessConfigureArgs.cmake
+++ b/cmake/QtProcessConfigureArgs.cmake
@@ -603,6 +603,16 @@ elseif(nr_of_build_configs GREATER 1)
list(APPEND cmake_args "-DCMAKE_CONFIGURATION_TYPES=${escaped_build_configs}")
endif()
+drop_input(ltcg)
+if("${INPUT_ltcg}" STREQUAL "yes")
+ foreach(config ${build_configs})
+ string(TOUPPER "${config}" ucconfig)
+ if(NOT ucconfig STREQUAL "DEBUG")
+ push("-DCMAKE_INTERPROCEDURAL_OPTIMIZATION_${ucconfig}=ON")
+ endif()
+ endforeach()
+endif()
+
translate_list_input(device-option QT_QMAKE_DEVICE_OPTIONS)
translate_list_input(defines QT_EXTRA_DEFINES)
translate_list_input(fpaths QT_EXTRA_FRAMEWORKPATHS)
diff --git a/cmake/configure-cmake-mapping.md b/cmake/configure-cmake-mapping.md
index 6e4b2c4549..780bbebef4 100644
--- a/cmake/configure-cmake-mapping.md
+++ b/cmake/configure-cmake-mapping.md
@@ -66,7 +66,8 @@ The effort of this is tracked in QTBUG-85373 and QTBUG-85349.
| -plugin-manifests | | |
| -static-runtime | -DFEATURE_static_runtime=ON | |
| -pch | -DBUILD_WITH_PCH=ON | |
-| -ltcg | | |
+| -ltcg | -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON or | |
+| | -DCMAKE_INTERPROCEDURAL_OPTIMIZATION_<CONFIG>=ON | |
| -linker [bfd,gold,lld] | -DINPUT_linker=<name> or | |
| | -DFEATURE_use_<name>_linker=ON | |
| -incredibuild-xge | n/a | This option enables remote distribution of Visual Studio |