Enabling C++ 17/20 for a plugin

Hi,
does anyone have experience with setting a more modern C++ standard for their plugin to compile with ParaView?

I added set_property(TARGET MyTarget PROPERTY CXX_STANDARD 17) to the CMakeLists.txt and in Visual Studio, the project shows up as using C++ 17 (see below) but I somehow still get errors saying that optional, nullopt, etc are not members of std.

Any ideas?

Hey!

Could you provide the MSVC version your are using and the compilation log?

For anyone wondering, the solution is to also set the standard for the auto-generated project vtkMyTargetCS, ie

set_property(
  TARGET
    MyTarget
    vtkMyTargetCS
  PROPERTY
    CXX_STANDARD 17
)

You may close the issue.

Good to know! Thanks for sharing the information with us.