summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2020-08-03 16:28:16 +0200
committerAlexandru Croitor <alexandru.croitor@qt.io>2020-08-06 19:15:39 +0200
commit92ee9bd6b885879090ba57e49c8bd84a06d42b2b (patch)
tree0c0c691394595bb5fff42d31632e1c9ea9a21ba7 /tests
parentbd2bcd4e1d38f18d2716cbebf7d106c090564217 (diff)
CMake: Properly handle CONFIG += thread aka Threads::Threads
mkspecs/features/qt.prf adds a dependency on the system threading library if the Qt Core thread feature is enabled. Because qt.prf is loaded by any public or internal Qt project, it's essentially a public dependency for any Qt consumer. To mimic that in CMake, we check if the thread feature is enabled, and and set the Threads::Threads library as a dependency of Qt6::Platform, which is a public target used by all Qt modules and plugins and Qt consumers. We also need to create a Qt6Dependencies.cmake file so we find_package(Threads) every time find_package(Qt6) is called. For the .prl files to be usable, we have to filter out some CMake implementation specific directory separator tokens 'CMAKE_DIRECTORY_ID_SEP' aka '::@', which are added because we call target_link_libraries() with a target created in a different scope (I think). As a result of this change, we shouldn't have to hardcode Threads::Threads in other projects, because it's now a global public dependency. Task-number: QTBUG-85801 Task-number: QTBUG-85877 Change-Id: Ib5d662c43b28e63f7da49d3bd77d0ad751220b31 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/CMakeLists.txt1
-rw-r--r--tests/auto/corelib/kernel/qmetatype/CMakeLists.txt1
-rw-r--r--tests/auto/corelib/thread/qpromise/CMakeLists.txt2
-rw-r--r--tests/auto/corelib/thread/qthread/CMakeLists.txt2
-rw-r--r--tests/auto/corelib/thread/qthreadstorage/CMakeLists.txt3
-rw-r--r--tests/auto/gui/kernel/qguiapplication/CMakeLists.txt1
-rw-r--r--tests/auto/gui/kernel/qguitimer/CMakeLists.txt1
-rw-r--r--tests/auto/network/socket/qtcpsocket/test/CMakeLists.txt6
-rw-r--r--tests/benchmarks/corelib/kernel/qtimer_vs_qmetaobject/CMakeLists.txt1
9 files changed, 0 insertions, 18 deletions
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 3642db7ee3..79da3331a8 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -6,7 +6,6 @@ if(QT_BUILD_STANDALONE_TESTS)
# special case begin
qt_find_package(WrapDBus1 PROVIDED_TARGETS dbus-1)
qt_find_package(ICU COMPONENTS i18n uc data PROVIDED_TARGETS ICU::i18n ICU::uc ICU::data)
- qt_find_package(Threads PROVIDED_TARGETS Threads::Threads)
qt_find_package(WrapOpenSSL PROVIDED_TARGETS WrapOpenSSL::WrapOpenSSL)
qt_find_package(WrapOpenSSLHeaders PROVIDED_TARGETS WrapOpenSSLHeaders::WrapOpenSSLHeaders)
# special case end
diff --git a/tests/auto/corelib/kernel/qmetatype/CMakeLists.txt b/tests/auto/corelib/kernel/qmetatype/CMakeLists.txt
index 0368578c4c..a6a3bb58c1 100644
--- a/tests/auto/corelib/kernel/qmetatype/CMakeLists.txt
+++ b/tests/auto/corelib/kernel/qmetatype/CMakeLists.txt
@@ -16,7 +16,6 @@ qt_add_test(tst_qmetatype
../../../other/qvariant_common
PUBLIC_LIBRARIES
Qt::CorePrivate
- Threads::Threads # special case
TESTDATA ${test_data}
)
diff --git a/tests/auto/corelib/thread/qpromise/CMakeLists.txt b/tests/auto/corelib/thread/qpromise/CMakeLists.txt
index c591092257..dc25a38fea 100644
--- a/tests/auto/corelib/thread/qpromise/CMakeLists.txt
+++ b/tests/auto/corelib/thread/qpromise/CMakeLists.txt
@@ -9,6 +9,4 @@ qt_add_test(tst_qpromise
tst_qpromise.cpp
PUBLIC_LIBRARIES
Qt::CorePrivate
- LIBRARIES # special case
- Threads::Threads # solves issue with libpthread linkage # special case
)
diff --git a/tests/auto/corelib/thread/qthread/CMakeLists.txt b/tests/auto/corelib/thread/qthread/CMakeLists.txt
index 1038eb7210..2c92a710b3 100644
--- a/tests/auto/corelib/thread/qthread/CMakeLists.txt
+++ b/tests/auto/corelib/thread/qthread/CMakeLists.txt
@@ -10,8 +10,6 @@ qt_add_test(tst_qthread
tst_qthread.cpp
INCLUDE_DIRECTORIES
../../../../shared
- LIBRARIES # special case
- Threads::Threads # special case
)
## Scopes:
diff --git a/tests/auto/corelib/thread/qthreadstorage/CMakeLists.txt b/tests/auto/corelib/thread/qthreadstorage/CMakeLists.txt
index 11ebf34799..e57f0c71ac 100644
--- a/tests/auto/corelib/thread/qthreadstorage/CMakeLists.txt
+++ b/tests/auto/corelib/thread/qthreadstorage/CMakeLists.txt
@@ -8,9 +8,6 @@
add_qt_test(tst_qthreadstorage
SOURCES
tst_qthreadstorage.cpp
- LIBRARIES # special case
- Threads::Threads # special case
-
)
## Scopes:
diff --git a/tests/auto/gui/kernel/qguiapplication/CMakeLists.txt b/tests/auto/gui/kernel/qguiapplication/CMakeLists.txt
index a98123aa64..d7219585a5 100644
--- a/tests/auto/gui/kernel/qguiapplication/CMakeLists.txt
+++ b/tests/auto/gui/kernel/qguiapplication/CMakeLists.txt
@@ -28,7 +28,6 @@ qt_add_test(tst_qguiapplication
PUBLIC_LIBRARIES
Qt::CorePrivate
Qt::GuiPrivate
- Threads::Threads # special case
)
# Resources:
diff --git a/tests/auto/gui/kernel/qguitimer/CMakeLists.txt b/tests/auto/gui/kernel/qguitimer/CMakeLists.txt
index 52be3ed547..8c2ec60bdf 100644
--- a/tests/auto/gui/kernel/qguitimer/CMakeLists.txt
+++ b/tests/auto/gui/kernel/qguitimer/CMakeLists.txt
@@ -10,5 +10,4 @@ qt_add_test(tst_qguitimer
PUBLIC_LIBRARIES
Qt::CorePrivate
Qt::Gui
- Threads::Threads # special case
)
diff --git a/tests/auto/network/socket/qtcpsocket/test/CMakeLists.txt b/tests/auto/network/socket/qtcpsocket/test/CMakeLists.txt
index 3903670156..a1a6dc172a 100644
--- a/tests/auto/network/socket/qtcpsocket/test/CMakeLists.txt
+++ b/tests/auto/network/socket/qtcpsocket/test/CMakeLists.txt
@@ -21,12 +21,6 @@ qt_extend_target(tst_qtcpsocket CONDITION WIN32
ws2_32
)
-# special case begin
-set(THREADS_PREFER_PTHREAD_FLAG 1)
-find_package(Threads)
-target_link_libraries(tst_qtcpsocket PRIVATE Threads::Threads)
-# special case end
-
#### Keys ignored in scope 4:.:.:test.pro:(CMAKE_BUILD_TYPE STREQUAL Debug):
# DESTDIR = "../debug"
diff --git a/tests/benchmarks/corelib/kernel/qtimer_vs_qmetaobject/CMakeLists.txt b/tests/benchmarks/corelib/kernel/qtimer_vs_qmetaobject/CMakeLists.txt
index 4dfba51735..2619d89779 100644
--- a/tests/benchmarks/corelib/kernel/qtimer_vs_qmetaobject/CMakeLists.txt
+++ b/tests/benchmarks/corelib/kernel/qtimer_vs_qmetaobject/CMakeLists.txt
@@ -11,7 +11,6 @@ qt_add_benchmark(qtimer_vs_qmetaobject
.
PUBLIC_LIBRARIES
Qt::Test
- Threads::Threads # special case
)
#### Keys ignored in scope 1:.:.:qtimer_vs_qmetaobject.pro:<TRUE>: