How to define an entry point when using `paraview_client_add`?

I would like to make ParaView accept custom command line arguments in my ParaView custom application. To achieve that, I want to pass the optional argument of type vtkCLIOptions* to the pqPVApplicationCore constructor.

You can do so by explicitly instantiating pqPVApplicationCore, as done in the Demo2 example. Then you have to write your own entry point int main(...). The Demo2 example manually creates the executable using the add_executable CMake command. The more complex custom applications, such as the SimpleParaView example or LidarView rather use the CMake macro paraview_client_add. In this case, the entry point is in the autogenerated file. How can I pass a custom entry point (in the Demo2 example, it is DemoApp2.cxx to paraview_client_add?

I read the following in the changelog:

Custom applications can easily add their own *Configuration classes to populate vtkCLIOptions to custom options or override the default ParaView ones. If your custom code was simply checking user selections from vtkPVOptions or subclasses, change it to using the corresponding *Configuration singleton

Is there an example out there ?

you can’t pass a custom main() to paraview_client_add. that macro always generates its own entry point, so files like DemoApp2.cxx won’t be used.

the way that works is:
don’t own main()

  1. subclass vtkCLIOptionsConfiguration
  2. register it so ParaView picks it up before pqPVApplicationCore is created
  3. add/override CLI options there

that’s what the changelog refers to. if you need full control over the entry point, you have to skip paraview_client_add and use add_executable instead.

Thank you. How can I implement step 2, i.e. registering it for ParaView?