summaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
authorJoerg Bornemann <joerg.bornemann@qt.io>2021-08-19 22:13:53 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-08-20 12:50:50 +0000
commit1d17a5a0520ae99ba1832f5db2ee8615fe9df010 (patch)
tree11bb8394de739c95f560b440fecbf479d89d84db /cmake
parent322e035841d7ac3acc6ecdec615ee5a736986e9a (diff)
Fix Android -ltcg build
We're passing -Oz for release builds, but that's not a flag the linker understands when -ltcg is enabled. The build fails with: ld.gold: fatal error: Optimization level must be between 0 and 3 Fix this by using -O2, which -Oz is based on, and -O3 for the "full optimization" that is used for core and gui. Fixes: QTBUG-89472 Change-Id: Ie1a86888baefce5ca97026e7d635f10d2819f9f4 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit 80de5165658e1cfb12d0813ea93dcfecca0dcb45) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'cmake')
-rw-r--r--cmake/QtCompilerOptimization.cmake10
1 files changed, 8 insertions, 2 deletions
diff --git a/cmake/QtCompilerOptimization.cmake b/cmake/QtCompilerOptimization.cmake
index c8c3da78d5..952ace6652 100644
--- a/cmake/QtCompilerOptimization.cmake
+++ b/cmake/QtCompilerOptimization.cmake
@@ -168,8 +168,14 @@ endif()
# Android Clang
if(CLANG AND ANDROID)
- set(QT_CFLAGS_OPTIMIZE "-Oz")
- set(QT_CFLAGS_OPTIMIZE_FULL "-Oz")
+ if(QT_FEATURE_ltcg)
+ # When using LTCG, the linker cannot cope with -Oz. See QTBUG-89472 for details.
+ set(QT_CFLAGS_OPTIMIZE "-O2")
+ set(QT_CFLAGS_OPTIMIZE_FULL "-O3")
+ else()
+ set(QT_CFLAGS_OPTIMIZE "-Oz")
+ set(QT_CFLAGS_OPTIMIZE_FULL "-Oz")
+ endif()
endif()
# qcc