From 92ee9bd6b885879090ba57e49c8bd84a06d42b2b Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Mon, 3 Aug 2020 16:28:16 +0200 Subject: 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 Reviewed-by: Cristian Adam --- src/plugins/sqldrivers/sqlite/CMakeLists.txt | 3 --- 1 file changed, 3 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/sqldrivers/sqlite/CMakeLists.txt b/src/plugins/sqldrivers/sqlite/CMakeLists.txt index 5cc2791e7d..154516b5ff 100644 --- a/src/plugins/sqldrivers/sqlite/CMakeLists.txt +++ b/src/plugins/sqldrivers/sqlite/CMakeLists.txt @@ -33,7 +33,6 @@ qt_extend_target(QSQLiteDriverPlugin CONDITION QT_FEATURE_system_sqlite # special case begin if (NOT QT_FEATURE_system_sqlite) - qt_find_package(Threads REQUIRED PROVIDED_TARGETS Threads::Threads) # On newer compilers compiling sqlite.c produces warnings qt_disable_warnings(QSQLiteDriverPlugin) endif() @@ -52,8 +51,6 @@ qt_extend_target(QSQLiteDriverPlugin CONDITION NOT QT_FEATURE_system_sqlite SQLITE_OMIT_COMPLETE INCLUDE_DIRECTORIES ../../../3rdparty/sqlite - PUBLIC_LIBRARIES # special case - Threads::Threads # special case ) qt_extend_target(QSQLiteDriverPlugin CONDITION CMAKE_BUILD_TYPE STREQUAL Release AND NOT QT_FEATURE_system_sqlite -- cgit v1.2.3