summaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
authorJoerg Bornemann <joerg.bornemann@qt.io>2021-08-19 22:13:53 +0200
committerJoerg Bornemann <joerg.bornemann@qt.io>2021-08-20 09:48:27 +0200
commit80de5165658e1cfb12d0813ea93dcfecca0dcb45 (patch)
treeedf29c46112990ecd5e0114c6b59ec545dd3eb47 /cmake
parentcd36734ff4ec568124b3f93759f7ba6113a0d75f (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. Pick-to: 6.2 Fixes: QTBUG-89472 Change-Id: Ie1a86888baefce5ca97026e7d635f10d2819f9f4 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
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