GDAL Library building/binding

I want to use vtkGDALRasterReader in my project. VTK is bound into my project using CMake, and I use VTK via add_subdirectory.

vtkGDARasterReader requires the GDAL library which is available from https://github.com/OSGeo/gdal

To build GDAL one needs the PROJ library, which is already in the ThirdParty directory of VTK.

Questions:

  • Why is the GDAL library not included in the build tree for VTK as a submodule?
  • Is there an elegant way to build GDAL via CMake, given that its PROJ dependency is already part of VTK?
  • Is there an “official” CMake way to build/bind in the GDAL library?

You can take a look at how the ParaView superbuild is building GDAL: https://gitlab.kitware.com/paraview/paraview-superbuild/-/blob/master/projects/gdal.cmake

It hasn’t been requested. However, it would take time and be prioritized with other tasks.

Please don’t. Use find_package(VTK). You’ll be happier.

VTK’s proj is mangled, so you can build GDAL with its own proj (as a bonus, you can point VTK at the same proj to share it).

Thanks for the replies. I went with @ben.boeckel 's suggestion and built the GDAL/PROJ/SQLITE3 dependency chain outside of the project - it was in the end the easiest solution.