diff options
author | Leander Beernaert <leander.beernaert@qt.io> | 2020-04-21 13:28:57 +0200 |
---|---|---|
committer | Leander Beernaert <leander.beernaert@qt.io> | 2020-04-22 09:51:12 +0200 |
commit | 6fbeef4c6b2323fc4b7856520c0f38f8139c9c54 (patch) | |
tree | 9457cdde24cfd8beeddbcf71d294a7af22457dc3 /examples | |
parent | 26a0a8942135fed725ec3067ba05bae31bb4e645 (diff) |
CMake: Add qt6_add_plugin public API
This patch adds a publicly callable qt6_add_plugin() API to create
plugins. This API is meant to cover cases such as the plugandpaint
example.
This patch also renames qt_add_plugin to qt_internal_add_plugin in order
to avoid clashes with the public API. To avoid breaking the existing
projects, a compatibility wrapper function is enabled by default unless
QT_DISABLE_QT_ADD_PLUGIN_COMPATIBILITY is specified.
Fixes: QTBUG-82961
Change-Id: If5b564a8406c90434f1bdad0b8df76d3e6626b5f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'examples')
5 files changed, 9 insertions, 7 deletions
diff --git a/examples/widgets/tools/CMakeLists.txt b/examples/widgets/tools/CMakeLists.txt index 3346cafe09..80c8f43007 100644 --- a/examples/widgets/tools/CMakeLists.txt +++ b/examples/widgets/tools/CMakeLists.txt @@ -15,7 +15,5 @@ add_subdirectory(undoframework) if(QT_FEATURE_library) # special case add_subdirectory(echoplugin) - # FIXME: Currently broken # special case - # Fails to link (ld: error: undefined symbol: qt_static_plugin_BasicToolsPlugin()) # special case - #add_subdirectory(plugandpaint) # special case + add_subdirectory(plugandpaint) # special case endif() diff --git a/examples/widgets/tools/plugandpaint/plugins/basictools/.prev_CMakeLists.txt b/examples/widgets/tools/plugandpaint/plugins/basictools/.prev_CMakeLists.txt index fefa30e2a4..76474c282b 100644 --- a/examples/widgets/tools/plugandpaint/plugins/basictools/.prev_CMakeLists.txt +++ b/examples/widgets/tools/plugandpaint/plugins/basictools/.prev_CMakeLists.txt @@ -15,7 +15,8 @@ find_package(Qt6 COMPONENTS Core) find_package(Qt6 COMPONENTS Gui) find_package(Qt6 COMPONENTS Widgets) -add_library(pnp_basictools MODULE +qt6_add_plugin(pnp_basictools STATIC) +target_sources(pnp_basictools PRIVATE basictoolsplugin.cpp basictoolsplugin.h ) target_include_directories(pnp_basictools PUBLIC diff --git a/examples/widgets/tools/plugandpaint/plugins/basictools/CMakeLists.txt b/examples/widgets/tools/plugandpaint/plugins/basictools/CMakeLists.txt index fefa30e2a4..b0a752718f 100644 --- a/examples/widgets/tools/plugandpaint/plugins/basictools/CMakeLists.txt +++ b/examples/widgets/tools/plugandpaint/plugins/basictools/CMakeLists.txt @@ -15,7 +15,8 @@ find_package(Qt6 COMPONENTS Core) find_package(Qt6 COMPONENTS Gui) find_package(Qt6 COMPONENTS Widgets) -add_library(pnp_basictools MODULE +qt_add_plugin(pnp_basictools STATIC) +target_sources(pnp_basictools PRIVATE basictoolsplugin.cpp basictoolsplugin.h ) target_include_directories(pnp_basictools PUBLIC diff --git a/examples/widgets/tools/plugandpaint/plugins/extrafilters/.prev_CMakeLists.txt b/examples/widgets/tools/plugandpaint/plugins/extrafilters/.prev_CMakeLists.txt index 2f689893bb..57f37843b8 100644 --- a/examples/widgets/tools/plugandpaint/plugins/extrafilters/.prev_CMakeLists.txt +++ b/examples/widgets/tools/plugandpaint/plugins/extrafilters/.prev_CMakeLists.txt @@ -15,7 +15,8 @@ find_package(Qt6 COMPONENTS Core) find_package(Qt6 COMPONENTS Gui) find_package(Qt6 COMPONENTS Widgets) -add_library(pnp_extrafilters MODULE +qt_add_plugin(pnp_extrafilters) +target_sources(pnp_extrafilters PRIVATE extrafiltersplugin.cpp extrafiltersplugin.h ) target_include_directories(pnp_extrafilters PUBLIC diff --git a/examples/widgets/tools/plugandpaint/plugins/extrafilters/CMakeLists.txt b/examples/widgets/tools/plugandpaint/plugins/extrafilters/CMakeLists.txt index 2f689893bb..57f37843b8 100644 --- a/examples/widgets/tools/plugandpaint/plugins/extrafilters/CMakeLists.txt +++ b/examples/widgets/tools/plugandpaint/plugins/extrafilters/CMakeLists.txt @@ -15,7 +15,8 @@ find_package(Qt6 COMPONENTS Core) find_package(Qt6 COMPONENTS Gui) find_package(Qt6 COMPONENTS Widgets) -add_library(pnp_extrafilters MODULE +qt_add_plugin(pnp_extrafilters) +target_sources(pnp_extrafilters PRIVATE extrafiltersplugin.cpp extrafiltersplugin.h ) target_include_directories(pnp_extrafilters PUBLIC |