From fe29159aad0e03ca5eebabf910c90f279b222d03 Mon Sep 17 00:00:00 2001 From: Craig Scott Date: Wed, 10 Feb 2021 12:11:39 +1100 Subject: cmake: Don't give plugins PUBLIC usage requirements The pro2cmake.py conversion script faithfully reproduced the .pro files for the plugins, which specified the libraries as public. But in CMake, the implications of this are that public usage requirements should then be propagated to consumers. We don't expect any consumers, since a plugin is created as a MODULE library in CMake, so for Windows we don't even have an import library to link with. The only exception to this is for static builds where plugins are created as STATIC libraries instead, but only in certain controlled situations do we then link to plugins. Even then, usage requirements are not expected to propagate to the consumers, so these relationships should always be specified as private. This change warns on any PUBLIC usage requirements specified for a plugin. This check is disabled by default to avoid spamming CI builds for repos that haven't been fixed yet. The check can be enabled by a CMake cache option, which is intended for developers to use locally when fixing this issue in other repos (all plugins in qtbase should not trigger this warning as a result of changes in this commit). Task-number: QTBUG-90819 Pick-to: 6.1 Change-Id: I09f2c8da77db1193ad3370f85d367dfc6ab7b9a6 Reviewed-by: Qt CI Bot Reviewed-by: Joerg Bornemann --- src/plugins/sqldrivers/db2/CMakeLists.txt | 2 +- src/plugins/sqldrivers/ibase/CMakeLists.txt | 2 +- src/plugins/sqldrivers/mysql/CMakeLists.txt | 2 +- src/plugins/sqldrivers/oci/CMakeLists.txt | 2 +- src/plugins/sqldrivers/odbc/CMakeLists.txt | 2 +- src/plugins/sqldrivers/psql/CMakeLists.txt | 2 +- src/plugins/sqldrivers/sqlite/CMakeLists.txt | 6 +++--- 7 files changed, 9 insertions(+), 9 deletions(-) (limited to 'src/plugins/sqldrivers') diff --git a/src/plugins/sqldrivers/db2/CMakeLists.txt b/src/plugins/sqldrivers/db2/CMakeLists.txt index 061eeae2fd..6d662434ae 100644 --- a/src/plugins/sqldrivers/db2/CMakeLists.txt +++ b/src/plugins/sqldrivers/db2/CMakeLists.txt @@ -13,7 +13,7 @@ qt_internal_add_plugin(QDB2DriverPlugin DEFINES QT_NO_CAST_FROM_ASCII QT_NO_CAST_TO_ASCII - PUBLIC_LIBRARIES + LIBRARIES DB2::DB2 Qt::Core Qt::CorePrivate diff --git a/src/plugins/sqldrivers/ibase/CMakeLists.txt b/src/plugins/sqldrivers/ibase/CMakeLists.txt index 8a78115505..5f200597f5 100644 --- a/src/plugins/sqldrivers/ibase/CMakeLists.txt +++ b/src/plugins/sqldrivers/ibase/CMakeLists.txt @@ -7,7 +7,7 @@ qt_internal_add_plugin(QIBaseDriverPlugin DEFINES QT_NO_CAST_FROM_ASCII QT_NO_CAST_TO_ASCII - PUBLIC_LIBRARIES + LIBRARIES Interbase::Interbase Qt::Core Qt::CorePrivate diff --git a/src/plugins/sqldrivers/mysql/CMakeLists.txt b/src/plugins/sqldrivers/mysql/CMakeLists.txt index 18409748df..8e8244acb3 100644 --- a/src/plugins/sqldrivers/mysql/CMakeLists.txt +++ b/src/plugins/sqldrivers/mysql/CMakeLists.txt @@ -13,7 +13,7 @@ qt_internal_add_plugin(QMYSQLDriverPlugin DEFINES QT_NO_CAST_FROM_ASCII QT_NO_CAST_TO_ASCII - PUBLIC_LIBRARIES + LIBRARIES MySQL::MySQL Qt::Core Qt::CorePrivate diff --git a/src/plugins/sqldrivers/oci/CMakeLists.txt b/src/plugins/sqldrivers/oci/CMakeLists.txt index 617fce8453..c6e38f4cdf 100644 --- a/src/plugins/sqldrivers/oci/CMakeLists.txt +++ b/src/plugins/sqldrivers/oci/CMakeLists.txt @@ -13,7 +13,7 @@ qt_internal_add_plugin(QOCIDriverPlugin DEFINES QT_NO_CAST_FROM_ASCII QT_NO_CAST_TO_ASCII - PUBLIC_LIBRARIES + LIBRARIES Oracle::OCI Qt::Core Qt::CorePrivate diff --git a/src/plugins/sqldrivers/odbc/CMakeLists.txt b/src/plugins/sqldrivers/odbc/CMakeLists.txt index 1c86a79acf..99a6b9104d 100644 --- a/src/plugins/sqldrivers/odbc/CMakeLists.txt +++ b/src/plugins/sqldrivers/odbc/CMakeLists.txt @@ -15,7 +15,7 @@ qt_internal_add_plugin(QODBCDriverPlugin DEFINES QT_NO_CAST_FROM_ASCII QT_NO_CAST_TO_ASCII - PUBLIC_LIBRARIES + LIBRARIES ODBC::ODBC Qt::Core Qt::CorePrivate diff --git a/src/plugins/sqldrivers/psql/CMakeLists.txt b/src/plugins/sqldrivers/psql/CMakeLists.txt index ab3d6c03aa..b151932da7 100644 --- a/src/plugins/sqldrivers/psql/CMakeLists.txt +++ b/src/plugins/sqldrivers/psql/CMakeLists.txt @@ -15,7 +15,7 @@ qt_internal_add_plugin(QPSQLDriverPlugin DEFINES QT_NO_CAST_FROM_ASCII QT_NO_CAST_TO_ASCII - PUBLIC_LIBRARIES + LIBRARIES PostgreSQL::PostgreSQL Qt::Core Qt::CorePrivate diff --git a/src/plugins/sqldrivers/sqlite/CMakeLists.txt b/src/plugins/sqldrivers/sqlite/CMakeLists.txt index 2da5233525..ad39f1547b 100644 --- a/src/plugins/sqldrivers/sqlite/CMakeLists.txt +++ b/src/plugins/sqldrivers/sqlite/CMakeLists.txt @@ -13,7 +13,7 @@ qt_internal_add_plugin(QSQLiteDriverPlugin DEFINES QT_NO_CAST_FROM_ASCII QT_NO_CAST_TO_ASCII - PUBLIC_LIBRARIES + LIBRARIES Qt::Core Qt::CorePrivate Qt::SqlPrivate @@ -27,7 +27,7 @@ qt_internal_add_plugin(QSQLiteDriverPlugin ##################################################################### qt_internal_extend_target(QSQLiteDriverPlugin CONDITION QT_FEATURE_system_sqlite - PUBLIC_LIBRARIES + LIBRARIES SQLite::SQLite3 ) @@ -79,7 +79,7 @@ qt_internal_extend_target(QSQLiteDriverPlugin CONDITION UNIX AND NOT QT_FEATURE_ ) qt_internal_extend_target(QSQLiteDriverPlugin CONDITION QT_FEATURE_dlopen AND NOT QT_FEATURE_system_sqlite - PUBLIC_LIBRARIES + LIBRARIES ${CMAKE_DL_LIBS} ) -- cgit v1.2.3