diff options
author | Christophe Giboudeaux <christophe@krop.fr> | 2021-01-12 12:31:10 +0100 |
---|---|---|
committer | Christophe Giboudeaux <christophe@krop.fr> | 2021-01-13 18:04:16 +0100 |
commit | 2d4a40f93fd3f0fd31110ef7d19a12fc56c00967 (patch) | |
tree | 1dad76d3888a2f1152e7cfed07d95ac9ea40761c /src/corelib | |
parent | 9563be2870b85309e163db950fefcb9200cac6f4 (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
Pick-to: 6.0
Change-Id: Ied62502ce9c7f7fd6b89fab166f7bccfcd6e7433
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'src/corelib')
-rw-r--r-- | src/corelib/CMakeLists.txt | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/src/corelib/CMakeLists.txt b/src/corelib/CMakeLists.txt index a33a4d2ac9..6524dd572e 100644 --- a/src/corelib/CMakeLists.txt +++ b/src/corelib/CMakeLists.txt @@ -53,7 +53,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 @@ -597,22 +596,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 |