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/imageformats/gif/CMakeLists.txt | 3 +-- src/plugins/imageformats/ico/CMakeLists.txt | 2 +- src/plugins/imageformats/jpeg/CMakeLists.txt | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) (limited to 'src/plugins/imageformats') diff --git a/src/plugins/imageformats/gif/CMakeLists.txt b/src/plugins/imageformats/gif/CMakeLists.txt index 9a9150bccc..1ffd702f85 100644 --- a/src/plugins/imageformats/gif/CMakeLists.txt +++ b/src/plugins/imageformats/gif/CMakeLists.txt @@ -11,9 +11,8 @@ qt_internal_add_plugin(QGifPlugin main.cpp main.h qgifhandler.cpp qgifhandler_p.h LIBRARIES # special case - Qt::GuiPrivate # special case - PUBLIC_LIBRARIES # special case Qt::Gui # special case + Qt::GuiPrivate # special case ) #### Keys ignored in scope 1:.:.:gif.pro:: diff --git a/src/plugins/imageformats/ico/CMakeLists.txt b/src/plugins/imageformats/ico/CMakeLists.txt index c5362df3e9..2d1dc38e17 100644 --- a/src/plugins/imageformats/ico/CMakeLists.txt +++ b/src/plugins/imageformats/ico/CMakeLists.txt @@ -10,7 +10,7 @@ qt_internal_add_plugin(QICOPlugin SOURCES main.cpp main.h qicohandler.cpp qicohandler.h - PUBLIC_LIBRARIES + LIBRARIES Qt::Core Qt::CorePrivate Qt::Gui diff --git a/src/plugins/imageformats/jpeg/CMakeLists.txt b/src/plugins/imageformats/jpeg/CMakeLists.txt index 7e69e1aba6..4b6e11235b 100644 --- a/src/plugins/imageformats/jpeg/CMakeLists.txt +++ b/src/plugins/imageformats/jpeg/CMakeLists.txt @@ -12,7 +12,7 @@ qt_internal_add_plugin(QJpegPlugin SOURCES main.cpp main.h qjpeghandler.cpp qjpeghandler_p.h - PUBLIC_LIBRARIES + LIBRARIES Qt::Core Qt::CorePrivate Qt::Gui -- cgit v1.2.3