summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChristophe Giboudeaux <christophe@krop.fr>2021-01-12 12:31:10 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-01-13 19:34:33 +0000
commit133e989cee5b4e3b32afa10618d700c0590a9c63 (patch)
tree140ce83c3b3902b12c809a6b3a6b291b238c26a3 /src
parent3f2b5fdf48e32ee01bcc1154adef5b3c530fb9bc (diff)
CMake: Fix build with GCC and ltcg
The porting script could not handle this special case. To achieve the same thing, we'll use an intermediate 'OBJECT' library which will get the '-fno-lto' build flag if the conditions are met. Fixes: QTBUG-89426 Change-Id: Ied62502ce9c7f7fd6b89fab166f7bccfcd6e7433 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> (cherry picked from commit 2d4a40f93fd3f0fd31110ef7d19a12fc56c00967) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src')
-rw-r--r--src/corelib/CMakeLists.txt31
1 files changed, 18 insertions, 13 deletions
diff --git a/src/corelib/CMakeLists.txt b/src/corelib/CMakeLists.txt
index 6389e9f09b..c4461da6b5 100644
--- a/src/corelib/CMakeLists.txt
+++ b/src/corelib/CMakeLists.txt
@@ -54,7 +54,6 @@ qt_internal_add_module(Core
global/qsysinfo.h
global/qsystemdetection.h
global/qtypeinfo.h
- global/qversiontagging.cpp global/qversiontagging.h # special case
io/qabstractfileengine.cpp io/qabstractfileengine_p.h
io/qbuffer.cpp io/qbuffer.h
io/qdataurl.cpp io/qdataurl_p.h
@@ -599,22 +598,28 @@ qt_internal_extend_target(Core CONDITION QT_FEATURE_journald
PkgConfig::Libsystemd
)
-#### Keys ignored in scope 39:.:global:global/global.pri:GCC AND ltcg:
-# QMAKE_EXTRA_COMPILERS = "versiontagging_compiler"
-# versiontagging_compiler.commands = "$$QMAKE_CXX" "-c" "$(CXXFLAGS)" "$(INCPATH)" "-fno-lto" "-o" "${QMAKE_FILE_OUT}" "${QMAKE_FILE_IN}"
-# versiontagging_compiler.dependency_type = "TYPE_C"
-# versiontagging_compiler.input = "VERSIONTAGGING_SOURCES"
-# versiontagging_compiler.name = "compiling[versiontagging]" "${QMAKE_FILE_IN}"
-# versiontagging_compiler.output = "${QMAKE_VAR_OBJECTS_DIR}${QMAKE_FILE_BASE}$${firstQMAKE_EXT_OBJ}"
-# versiontagging_compiler.variable_out = "OBJECTS"
+# special case begin
+add_library(Core_versiontagging OBJECT
+ global/qversiontagging.cpp global/qversiontagging.h
+)
-#### Keys ignored in scope 40:.:global:global/global.pri:silent:
-# versiontagging_compiler.commands = "@echo" "compiling[versiontagging]" "${QMAKE_FILE_IN}" "&&"
+set_target_properties(Core_versiontagging PROPERTIES
+ COMPILE_OPTIONS $<TARGET_PROPERTY:Core,COMPILE_OPTIONS>
+ COMPILE_DEFINITIONS $<TARGET_PROPERTY:Core,COMPILE_DEFINITIONS>
+ INCLUDE_DIRECTORIES $<TARGET_PROPERTY:Core,INCLUDE_DIRECTORIES>
+)
+
+# Disable LTO, as the symbols disappear somehow under GCC
+# (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=48200)
+if(GCC AND FEATURE_ltcg)
+ target_compile_options(Core_versiontagging PRIVATE "-fno-lto")
+endif()
-qt_internal_extend_target(Core CONDITION NOT GCC OR NOT ltcg
+qt_internal_extend_target(Core
SOURCES
- global/qversiontagging.cpp
+ $<TARGET_OBJECTS:Core_versiontagging>
)
+# special case end
qt_internal_extend_target(Core CONDITION UNIX
SOURCES