diff options
author | Joerg Bornemann <joerg.bornemann@qt.io> | 2020-08-27 14:11:00 +0200 |
---|---|---|
committer | Joerg Bornemann <joerg.bornemann@qt.io> | 2020-09-11 11:30:56 +0200 |
commit | 96bdcdacbc09b1f3091a39b83fe394af1ccb41ea (patch) | |
tree | ccca51911ad88c3cb05a9205e30201e53c57733d /configure.cmake | |
parent | 756c65d3676d2b3ce5c7b56145e5f0f7cf7178ad (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 'configure.cmake')
-rw-r--r-- | configure.cmake | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/configure.cmake b/configure.cmake index 754f0c324c..8e7ba06299 100644 --- a/configure.cmake +++ b/configure.cmake @@ -616,11 +616,23 @@ qt_feature("precompile_header" CONDITION BUILD_WITH_PCH ) qt_feature_config("precompile_header" QMAKE_PRIVATE_CONFIG) +set(__qt_ltcg_detected FALSE) +if(CMAKE_INTERPROCEDURAL_OPTIMIZATION) + set(__qt_ltcg_detected TRUE) +else() + foreach(config ${CMAKE_BUILD_TYPE} ${CMAKE_CONFIGURATION_TYPES}) + if(CMAKE_INTERPROCEDURAL_OPTIMIZATION_${config}) + set(__qt_ltcg_detected TRUE) + break() + endif() + endforeach() +endif() qt_feature("ltcg" LABEL "Using LTCG" - AUTODETECT 1 - CONDITION CMAKE_INTERPROCEDURAL_OPTIMIZATION + AUTODETECT ON + CONDITION __qt_ltcg_detected ) +unset(__qt_ltcg_detected) qt_feature_config("ltcg" QMAKE_PRIVATE_CONFIG) qt_feature("enable_gdb_index" LABEL "Generating GDB index" |