Linking ParaView modules into plugins

Hello!

I am waist deep in plugin development right now and I came across a behavior in ParaView plugin building that I’m not super clear on. I have an example plugin where I have taken the /Examples/Plugins/PropertyWidgets and added an interactive widget (just a simple HandlePropertyWidget with slight modifications). In building this plugin for ParaView 5.8, the paraview.plugin file includes all the modules related to ParaView Qt interaction (and probably way more than I need for this plugin)
NAME
PropertyWidgets
DESCRIPTION
An example plugin with an added handle widget example.
REQUIRES_MODULES
ParaView::pqCore
ParaView::pqWidgets
ParaView::pqComponents
ParaView::pqApplicationComponents
ParaView::RemotingServerManager
ParaView::RemotingViews
VTK::CommonDataModel
VTK::CommonExecutionModel
VTK::CommonTransforms
VTK::FiltersGeometry
VTK::FiltersSources
VTK::RenderingCore
VTK::InteractionWidgets
VTK::CommonCore
VTK::FiltersCore
VTK::FiltersGeneral

But when I go to build the plugin, I get linker errors that all the symbols related to the pqInteractivePropertyWidget cannot be found! to fix this, I modified the line find_package(ParaView REQUIRED) to

find_package(ParaView REQUIRED COMPONENTS pqCore
pqWidgets
pqComponents
pqApplicationComponents
RemotingServerManager
RemotingViews)

link_libraries(ParaView::pqCore
ParaView::pqWidgets
ParaView::pqComponents
ParaView::pqApplicationComponents
ParaView::RemotingServerManager
ParaView::RemotingViews)

and this collected all the symbols and the plugin built and now runs correctly. My question is: Why did adding the ParaView components to the paraview.plugin NOT link the requisite pq objects?

Thanks in advance!

REQUIRES_MODULES does not automatically link anything within the plugin APIs. This is because plugins might be XML and not link anything at all. The fix is to do target_link_libraries(PropertyWidgets PRIVATE ParaView::…) in the associated CMakeLists.txt. The list is there to basically manage the enabled set of modules and hide plugins that are not possible or (as ParaView itself uses it) to turn on modules that enabled plugins require.