From bd70f6d5503ead56012a9703b110b2080fd266e4 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 Change-Id: I09f2c8da77db1193ad3370f85d367dfc6ab7b9a6 Reviewed-by: Qt CI Bot Reviewed-by: Joerg Bornemann (cherry picked from commit fe29159aad0e03ca5eebabf910c90f279b222d03) Reviewed-by: Qt Cherry-pick Bot --- src/plugins/platforms/windows/CMakeLists.txt | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) (limited to 'src/plugins/platforms/windows') diff --git a/src/plugins/platforms/windows/CMakeLists.txt b/src/plugins/platforms/windows/CMakeLists.txt index 77d2f2a714..43f08a6a86 100644 --- a/src/plugins/platforms/windows/CMakeLists.txt +++ b/src/plugins/platforms/windows/CMakeLists.txt @@ -43,21 +43,20 @@ qt_internal_add_plugin(QWindowsIntegrationPlugin INCLUDE_DIRECTORIES ${CMAKE_CURRENT_SOURCE_DIR} LIBRARIES - advapi32 - gdi32 - ole32 - shell32 - user32 - winmm - PUBLIC_LIBRARIES Qt::Core Qt::CorePrivate Qt::Gui Qt::GuiPrivate + advapi32 dwmapi + gdi32 imm32 + ole32 oleaut32 + shell32 shlwapi + user32 + winmm winspool wtsapi32 ) @@ -88,7 +87,7 @@ qt_internal_extend_target(QWindowsIntegrationPlugin CONDITION QT_FEATURE_opengl SOURCES qwindowsglcontext.cpp qwindowsglcontext.h qwindowsopenglcontext.h - PUBLIC_LIBRARIES + LIBRARIES Qt::OpenGLPrivate ) @@ -96,12 +95,12 @@ qt_internal_extend_target(QWindowsIntegrationPlugin CONDITION QT_FEATURE_opengl # PLUGIN_EXTENDS = "-" qt_internal_extend_target(QWindowsIntegrationPlugin CONDITION QT_FEATURE_opengl AND NOT QT_FEATURE_dynamicgl - PUBLIC_LIBRARIES + LIBRARIES opengl32 ) qt_internal_extend_target(QWindowsIntegrationPlugin CONDITION MINGW - PUBLIC_LIBRARIES + LIBRARIES uuid ) @@ -195,7 +194,7 @@ qt_internal_extend_target(QWindowsIntegrationPlugin CONDITION QT_FEATURE_accessi ) qt_internal_extend_target(QWindowsIntegrationPlugin CONDITION MINGW AND QT_FEATURE_accessibility - PUBLIC_LIBRARIES + LIBRARIES uuid ) -- cgit v1.2.3