Understanding package names

Hi there,

I’m trying to learn how to find the package name for a particular class in VTK with c++ and cmake. I feel like I’ve been going through examples and blindly following what the authors suggest should go inside the find_package(...) parentheses and I’d love to understand it better. One example is if I’m now trying to be able to use the vtkStructuredGrid class and I need to be able to include #include <vtkStructuredGridAlgorithm.h> what is the way I should infer the package name for the cmake lists? Thanks!

“package” - or module as the VTK infrastructure calls them - naming follows the directory names of the source code. For example, vtkStructuredGrid.h is located at Common/DataModel/vtkStructuredGrid.h and the module that holds the implementation of vtkStructuredGrid is VTK::CommonDataModel.

Similarly, vtkStructuredGridAlgorithm.h is under Common/ExecutionModel thus, the corresponding module name is VTK::CommonExecutionModel.

Additionally , you may use the python script Utilities/Maintenance/FindNeededModules.py that returns the module names needed for a given source file.

1 Like

oh that script is a gold mine! And overall I think this makes much more sense now. Thank you!