# GDAL Library building/binding

**URL:** https://discourse.vtk.org/t/gdal-library-building-binding/8787
**Category:** Support
**Created:** [June 23, 2022, 4:48am UTC](https://discourse.vtk.org/t/gdal-library-building-binding/8787 "2022-06-23T04:48:53Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![drpeterfranz](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/d/f19dbf/32.png) [@drpeterfranz](https://discourse.vtk.org/u/drpeterfranz)
#### Post date: [June 23, 2022, 4:48am UTC](https://discourse.vtk.org/t/gdal-library-building-binding/8787/1 "2022-06-23T04:48:53Z")

</div>

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](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?

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.vtk.org/user_avatar/discourse.vtk.org/mwestphal/32/19_2.png) [@mwestphal](https://discourse.vtk.org/u/mwestphal)
#### Post date: [June 23, 2022, 8:46am UTC](https://discourse.vtk.org/t/gdal-library-building-binding/8787/2 "2022-06-23T08:46:52Z")

</div>

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](https://gitlab.kitware.com/paraview/paraview-superbuild/-/blob/master/projects/gdal.cmake)

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.vtk.org/u/ben.boeckel)
#### Post date: [June 23, 2022, 11:55am UTC](https://discourse.vtk.org/t/gdal-library-building-binding/8787/3 "2022-06-23T11:55:05Z")

</div>

> [@drpeterfranz](#):
>
> Why is the GDAL library not included in the build tree for VTK as a submodule?

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

> [@drpeterfranz](#):
>
> and I use VTK via _add\_subdirectory_.

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

> [@drpeterfranz](#):
>
> Is there an elegant way to build GDAL via CMake, given that its PROJ dependency is already part of VTK?

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).

---

<div class="post-metadata">

### Author: ![drpeterfranz](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/d/f19dbf/32.png) [@drpeterfranz](https://discourse.vtk.org/u/drpeterfranz)
#### Post date: [June 24, 2022, 11:38pm UTC](https://discourse.vtk.org/t/gdal-library-building-binding/8787/4 "2022-06-24T23:38:18Z")

</div>

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.
