CMake: Fix building with -DQT_FEATURE_gui=OFF

Some CMake files currently assume that QtGui is always enabled and we
get a configure-time failure without these changes.

Task-number: QTBUG-86053
Change-Id: I28e32c180c32221f32519017bac6b518a19d5983
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
bb10
Alex Richardson 2020-09-03 15:01:05 +01:00 committed by Alexandru Croitor
parent 93fc3afe71
commit 44920e7fb2
28 changed files with 178 additions and 40 deletions

View File

@ -1,17 +1,17 @@
# special case skip regeneration
# The file is maintained manually
if(QT_FEATURE_png AND NOT QT_FEATURE_system_png)
if(QT_FEATURE_gui AND QT_FEATURE_png AND NOT QT_FEATURE_system_png)
add_subdirectory(libpng)
endif()
qt_install_3rdparty_library_wrap_config_extra_file(BundledLibpng)
if(QT_FEATURE_freetype AND NOT QT_FEATURE_system_freetype)
if(QT_FEATURE_gui AND QT_FEATURE_freetype AND NOT QT_FEATURE_system_freetype)
add_subdirectory(freetype)
endif()
qt_install_3rdparty_library_wrap_config_extra_file(BundledFreetype)
if(QT_FEATURE_harfbuzz AND NOT QT_FEATURE_system_harfbuzz)
if(QT_FEATURE_gui AND QT_FEATURE_harfbuzz AND NOT QT_FEATURE_system_harfbuzz)
add_subdirectory(harfbuzz-ng)
endif()
qt_install_3rdparty_library_wrap_config_extra_file(BundledHarfbuzz)

View File

@ -5,8 +5,12 @@
# should be built.
# The order of evaluation matters.
qt_feature_evaluate_features("${CMAKE_CURRENT_SOURCE_DIR}/corelib/configure.cmake")
qt_feature_evaluate_features("${CMAKE_CURRENT_SOURCE_DIR}/network/configure.cmake")
qt_feature_evaluate_features("${CMAKE_CURRENT_SOURCE_DIR}/gui/configure.cmake")
if(QT_FEATURE_network)
qt_feature_evaluate_features("${CMAKE_CURRENT_SOURCE_DIR}/network/configure.cmake")
endif()
if(QT_FEATURE_gui)
qt_feature_evaluate_features("${CMAKE_CURRENT_SOURCE_DIR}/gui/configure.cmake")
endif()
add_subdirectory(3rdparty)

View File

@ -9,5 +9,7 @@ add_subdirectory(qvkgen)
# Only include the following tools when performing a host build
if(NOT CMAKE_CROSSCOMPILING)
add_subdirectory(androiddeployqt)
add_subdirectory(androidtestrunner)
if(QT_FEATURE_gui)
add_subdirectory(androidtestrunner)
endif()
endif()

View File

@ -11,10 +11,6 @@ endif()
if(QT_FEATURE_process AND NOT CMAKE_CROSSCOMPILING)
add_subdirectory(tools)
endif()
if(NOT CMAKE_CROSSCOMPILING)
add_subdirectory(cmake)
add_subdirectory(installed_cmake)
endif()
if(TARGET Qt::Concurrent)
add_subdirectory(concurrent)
endif()

View File

@ -17,7 +17,11 @@ if (NOT CMAKE_CROSSCOMPILE AND QT_FEATURE_process)
add_subdirectory(tools)
endif()
add_subdirectory(corelib)
add_subdirectory(cmake)
# special case begin
if (TARGET Qt::Xml AND TARGET Qt::Sql AND TARGET Qt::Network)
add_subdirectory(cmake)
endif()
# special case end
if (TARGET Qt::Concurrent)
add_subdirectory(concurrent)
endif()

View File

@ -0,0 +1,13 @@
# Generated from testExitCodes.pro.
#####################################################################
## testExitCodes Binary:
#####################################################################
qt_add_executable(testExitCodes
OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/"
SOURCES
main.cpp
PUBLIC_LIBRARIES
Qt::Gui
)

View File

@ -8,6 +8,6 @@ qt_add_executable(testExitCodes
OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/"
SOURCES
main.cpp
PUBLIC_LIBRARIES
Qt::Gui
#PUBLIC_LIBRARIES # special case remove
#Qt::Gui # special case remove
)

View File

@ -0,0 +1,13 @@
# Generated from testForwardingHelper.pro.
#####################################################################
## testForwardingHelper Binary:
#####################################################################
qt_add_executable(testForwardingHelper
OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/"
SOURCES
main.cpp
PUBLIC_LIBRARIES
Qt::Gui
)

View File

@ -8,6 +8,6 @@ qt_add_executable(testForwardingHelper
OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/"
SOURCES
main.cpp
PUBLIC_LIBRARIES
Qt::Gui
#PUBLIC_LIBRARIES # special case remove
#Qt::Gui # special case remove
)

View File

@ -0,0 +1,13 @@
# Generated from testProcessCrash.pro.
#####################################################################
## testProcessCrash Binary:
#####################################################################
qt_add_executable(testProcessCrash
OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/"
SOURCES
main.cpp
PUBLIC_LIBRARIES
Qt::Gui
)

View File

@ -8,6 +8,6 @@ qt_add_executable(testProcessCrash
OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/"
SOURCES
main.cpp
PUBLIC_LIBRARIES
Qt::Gui
#PUBLIC_LIBRARIES # special case remove
#Qt::Gui # special case remove
)

View File

@ -0,0 +1,13 @@
# Generated from testProcessDeadWhileReading.pro.
#####################################################################
## testProcessDeadWhileReading Binary:
#####################################################################
qt_add_executable(testProcessDeadWhileReading
OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/"
SOURCES
main.cpp
PUBLIC_LIBRARIES
Qt::Gui
)

View File

@ -8,6 +8,6 @@ qt_add_executable(testProcessDeadWhileReading
OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/"
SOURCES
main.cpp
PUBLIC_LIBRARIES
Qt::Gui
#PUBLIC_LIBRARIES # special case remove
#Qt::Gui # special case remove
)

View File

@ -0,0 +1,13 @@
# Generated from testProcessEOF.pro.
#####################################################################
## testProcessEOF Binary:
#####################################################################
qt_add_executable(testProcessEOF
OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/"
SOURCES
main.cpp
PUBLIC_LIBRARIES
Qt::Gui
)

View File

@ -8,6 +8,6 @@ qt_add_executable(testProcessEOF
OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/"
SOURCES
main.cpp
PUBLIC_LIBRARIES
Qt::Gui
#PUBLIC_LIBRARIES # special case remove
#Qt::Gui # special case remove
)

View File

@ -0,0 +1,13 @@
# Generated from testProcessEcho.pro.
#####################################################################
## testProcessEcho Binary:
#####################################################################
qt_add_executable(testProcessEcho
OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/"
SOURCES
main.cpp
PUBLIC_LIBRARIES
Qt::Gui
)

View File

@ -8,6 +8,6 @@ qt_add_executable(testProcessEcho
OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/"
SOURCES
main.cpp
PUBLIC_LIBRARIES
Qt::Gui
#PUBLIC_LIBRARIES # special case remove
#Qt::Gui # special case remove
)

View File

@ -0,0 +1,13 @@
# Generated from testProcessEcho2.pro.
#####################################################################
## testProcessEcho2 Binary:
#####################################################################
qt_add_executable(testProcessEcho2
OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/"
SOURCES
main.cpp
PUBLIC_LIBRARIES
Qt::Gui
)

View File

@ -8,6 +8,6 @@ qt_add_executable(testProcessEcho2
OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/"
SOURCES
main.cpp
PUBLIC_LIBRARIES
Qt::Gui
#PUBLIC_LIBRARIES # special case remove
#Qt::Gui # special case remove
)

View File

@ -0,0 +1,13 @@
# Generated from testProcessEcho3.pro.
#####################################################################
## testProcessEcho3 Binary:
#####################################################################
qt_add_executable(testProcessEcho3
OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/"
SOURCES
main.cpp
PUBLIC_LIBRARIES
Qt::Gui
)

View File

@ -8,6 +8,6 @@ qt_add_executable(testProcessEcho3
OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/"
SOURCES
main.cpp
PUBLIC_LIBRARIES
Qt::Gui
#PUBLIC_LIBRARIES # special case remove
#Qt::Gui # special case remove
)

View File

@ -0,0 +1,13 @@
# Generated from testProcessEnvironment.pro.
#####################################################################
## testProcessEnvironment Binary:
#####################################################################
qt_add_executable(testProcessEnvironment
OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/"
SOURCES
main.cpp
PUBLIC_LIBRARIES
Qt::Gui
)

View File

@ -8,6 +8,6 @@ qt_add_executable(testProcessEnvironment
OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/"
SOURCES
main.cpp
PUBLIC_LIBRARIES
Qt::Gui
#PUBLIC_LIBRARIES # special case remove
#Qt::Gui # special case remove
)

View File

@ -0,0 +1,13 @@
# Generated from testProcessHang.pro.
#####################################################################
## testProcessHang Binary:
#####################################################################
qt_add_executable(testProcessHang
OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/"
SOURCES
main.cpp
PUBLIC_LIBRARIES
Qt::Gui
)

View File

@ -8,6 +8,6 @@ qt_add_executable(testProcessHang
OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/"
SOURCES
main.cpp
PUBLIC_LIBRARIES
Qt::Gui
#PUBLIC_LIBRARIES # special case remove
#Qt::Gui # special case remove
)

View File

@ -10,8 +10,8 @@ qt_add_executable(nospace
main.cpp
DEFINES
QT_DISABLE_DEPRECATED_BEFORE=0
PUBLIC_LIBRARIES
Qt::Gui
#PUBLIC_LIBRARIES # special case remove
#Qt::Gui # special case remove
)
# special case begin
@ -21,8 +21,8 @@ qt_add_executable(onespace
main.cpp
DEFINES
QT_DISABLE_DEPRECATED_BEFORE=0
PUBLIC_LIBRARIES
Qt::Gui
#PUBLIC_LIBRARIES # special case remove
#Qt::Gui # special case remove
)
set_target_properties(onespace PROPERTIES OUTPUT_NAME "one space")
@ -32,8 +32,8 @@ qt_add_executable(twospaces
main.cpp
DEFINES
QT_DISABLE_DEPRECATED_BEFORE=0
PUBLIC_LIBRARIES
Qt::Gui
#PUBLIC_LIBRARIES # special case remove
#Qt::Gui # special case remove
)
set_target_properties(twospaces PROPERTIES OUTPUT_NAME "two space s")
# special case end

View File

@ -10,19 +10,19 @@ add_subdirectory(qmetaobject)
add_subdirectory(qmetaobjectbuilder)
add_subdirectory(qmetamethod)
add_subdirectory(qmetaproperty)
add_subdirectory(qmetatype)
add_subdirectory(qmetaenum)
add_subdirectory(qpointer)
add_subdirectory(qsignalblocker)
add_subdirectory(qsignalmapper)
add_subdirectory(qtimer)
add_subdirectory(qtranslator)
add_subdirectory(qvariant)
if(TARGET Qt::Network)
add_subdirectory(qeventloop)
endif()
if(TARGET Qt::Gui)
add_subdirectory(qmetatype)
add_subdirectory(qmimedata)
add_subdirectory(qvariant)
endif()
if(TARGET Qt::Network AND NOT ANDROID AND NOT UIKIT)
add_subdirectory(qobject)

View File

@ -28,7 +28,9 @@ SUBDIRS=\
qproperty
!qtHaveModule(gui): SUBDIRS -= \
qmimedata
qmimedata \
qvariant \
qmetatype
!qtHaveModule(network): SUBDIRS -= \
qeventloop \