CMake: Do not link qmake against Qt (not even the bootstrap one)

Qmake should not rebuild all the code in QtCore, but currently it does.
When linking against QtCore, all the symbols get duplicated. A clever
linker will "deduplicate" the symbols again, so this actually works
with shared Qt builds, but it fails for static builds.

Do not rely on the linker being clever and just do not link Qt at all
for qmake.

Change-Id: I0f79ed9176a19ee884dd425e5f23c26cf69dc422
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
bb10
Tobias Hunger 2019-04-29 13:14:22 +02:00
parent c43b57c9b8
commit a1752276e0
2 changed files with 14 additions and 5 deletions

View File

@ -924,14 +924,22 @@ function(add_qt_tool name)
return()
endif()
qt_parse_all_arguments(arg "add_qt_tool" "BOOTSTRAP;NO_INSTALL" "" "${__default_private_args}" ${ARGN})
qt_parse_all_arguments(arg "add_qt_tool" "BOOTSTRAP;NO_QT;NO_INSTALL" "" "${__default_private_args}" ${ARGN})
set(disable_autogen_tools "${arg_DISABLE_AUTOGEN_TOOLS}")
if (arg_BOOTSTRAP)
set(corelib ${QT_CMAKE_EXPORT_NAMESPACE}::Bootstrap)
list(APPEND disable_autogen_tools "uic" "moc" "rcc")
if (arg_NO_QT)
# FIXME: Remove NO_QT again once qmake can use a "normal" Qt!
if (arg_BOOTSTRAP)
message(FATAL_ERROR "Tool can not be NO_QT and BOOTSTRAP at the same time!")
endif()
set(corelib "")
else()
set(corelib ${QT_CMAKE_EXPORT_NAMESPACE}::Core)
if (arg_BOOTSTRAP)
set(corelib ${QT_CMAKE_EXPORT_NAMESPACE}::Bootstrap)
list(APPEND disable_autogen_tools "uic" "moc" "rcc")
else()
set(corelib ${QT_CMAKE_EXPORT_NAMESPACE}::Core)
endif()
endif()
set(bootstrap "")

View File

@ -12,6 +12,7 @@ find_library(FWFoundation Foundation) # special case
#####################################################################
add_qt_tool(qmake # special case
NO_QT # special case
# GUI # special case: remove this
SOURCES
../src/corelib/codecs/qutfcodec.cpp ../src/corelib/codecs/qutfcodec_p.h