Skip to content

CMake: mismatch between docs and driver flags #5809

@adamjstewart

Description

@adamjstewart

I'm working on updating Spack's GDAL package for the new CMake build system (which is amazing btw). I noticed a few inconsistencies between the docs and the actual behavior I encountered w.r.t. driver flags.

Required vs. optional drivers

According to https://gdal.org/build_hints.html#selection-of-drivers, -DGDAL_BUILD_OPTIONAL_DRIVERS=OFF -DOGR_BUILD_OPTIONAL_DRIVERS=OFF should "Globally disable all GDAL/raster or OGR/vector drivers". However, I still see several drivers being built:

-- Enabled drivers and features and found dependency packages
-- The following features have been enabled:

 * gdal_ISO8211, iso8211 library
 * gdal_GTIFF, GeoTIFF image format
 * gdal_MEM, Read/write data in Memory
 * gdal_VRT, Virtual GDAL Datasets
 * gdal_HFA, Erdas Imagine .img
 * ogr_MEM, Read/write driver for MEMORY virtual files
 * ogr_GEOJSON, GeoJSON/ESRIJSON/TopoJSON driver
 * ogr_TAB, MapInfo TAB and MIF/MID
 * ogr_SHAPE, ESRI shape-file
 * ogr_KML, KML
 * ogr_VRT, VRT - Virtual Format

I think this one just needs clarification in the docs that these particular drivers are not optional, they are always built.

Interestingly, gdalinfo reports a different subset of drivers:

$ gdalinfo --formats
Supported Formats:
  VRT -raster,multidimensional raster- (rw+v): Virtual Raster
  DERIVED -raster- (ro): Derived datasets using VRT pixel functions
  GTiff -raster- (rw+vs): GeoTIFF
  COG -raster- (wv): Cloud optimized GeoTIFF generator
  HFA -raster- (rw+v): Erdas Imagine Images (.img)
  MEM -raster,multidimensional raster- (rw+): In Memory Raster

Driver names in docs do not match CMake flags

According to https://gdal.org/build_hints.html#selection-of-drivers, I can enable/disable all drivers by their driver name. However, some CMake flags do not match the names listed in https://gdal.org/drivers/vector/index.html:

  • MITAB: CMake flags calls it TAB, not MITAB
  • ESRI Shapefile: CMake flags calls it SHAPE, not ESRI_SHAPEFILE

Undocumented drivers

CMake seems to be building the following driver:

* gdal_ISO8211, iso8211 library

But this driver is not documented at https://gdal.org/drivers/raster/index.html.

Documented, but flag is not respected

In Spack we would like to be able to explicitly enable/disable all drivers. However, many of the drivers listed at https://gdal.org/drivers/raster/index.html and https://gdal.org/drivers/vector/index.html do not seem to have corresponding CMake flags:

CMake Warning:
  Manually-specified variables were not used by the project:

    GDAL_ENABLE_DRIVER_ACE2
    GDAL_ENABLE_DRIVER_AIG
    GDAL_ENABLE_DRIVER_BAG
    GDAL_ENABLE_DRIVER_BT
    GDAL_ENABLE_DRIVER_BYN
    GDAL_ENABLE_DRIVER_CAD
    GDAL_ENABLE_DRIVER_COG
    GDAL_ENABLE_DRIVER_CPG
    GDAL_ENABLE_DRIVER_CTABLE2
    GDAL_ENABLE_DRIVER_DERIVED
    GDAL_ENABLE_DRIVER_DIPEX
    GDAL_ENABLE_DRIVER_DOQ1
    GDAL_ENABLE_DRIVER_DOQ2
    GDAL_ENABLE_DRIVER_ECRGTOC
    GDAL_ENABLE_DRIVER_EEDAI
    GDAL_ENABLE_DRIVER_EHDR
    GDAL_ENABLE_DRIVER_EIR
    GDAL_ENABLE_DRIVER_ENVI
    GDAL_ENABLE_DRIVER_ESAT
    GDAL_ENABLE_DRIVER_FAST
    GDAL_ENABLE_DRIVER_GENBIN
    GDAL_ENABLE_DRIVER_GEORASTER
    GDAL_ENABLE_DRIVER_GPKG
    GDAL_ENABLE_DRIVER_GRASS
    GDAL_ENABLE_DRIVER_GRASSASCIIGRID
    GDAL_ENABLE_DRIVER_GS7BG
    GDAL_ENABLE_DRIVER_GSAG
    GDAL_ENABLE_DRIVER_GSBG
    GDAL_ENABLE_DRIVER_GSC
    GDAL_ENABLE_DRIVER_ISCE
    GDAL_ENABLE_DRIVER_ISG
    GDAL_ENABLE_DRIVER_ISIS2
    GDAL_ENABLE_DRIVER_ISIS3
    GDAL_ENABLE_DRIVER_JP2ECW
    GDAL_ENABLE_DRIVER_JP2MRSID
    GDAL_ENABLE_DRIVER_JPEGXL
    GDAL_ENABLE_DRIVER_KRO
    GDAL_ENABLE_DRIVER_LAN
    GDAL_ENABLE_DRIVER_LCP
    GDAL_ENABLE_DRIVER_LOSLAS
    GDAL_ENABLE_DRIVER_MFF
    GDAL_ENABLE_DRIVER_MFF2
    GDAL_ENABLE_DRIVER_NDF
    GDAL_ENABLE_DRIVER_NGW
    GDAL_ENABLE_DRIVER_NTV2
    GDAL_ENABLE_DRIVER_NWT_GRC
    GDAL_ENABLE_DRIVER_NWT_GRD
    GDAL_ENABLE_DRIVER_PAUX
    GDAL_ENABLE_DRIVER_PDS4
    GDAL_ENABLE_DRIVER_PNM
    GDAL_ENABLE_DRIVER_ROI_PAC
    GDAL_ENABLE_DRIVER_RPFTOC
    GDAL_ENABLE_DRIVER_RRASTER
    GDAL_ENABLE_DRIVER_RST
    GDAL_ENABLE_DRIVER_SNODAS
    GDAL_ENABLE_DRIVER_SQLITE
    GDAL_ENABLE_DRIVER_SRP
    GDAL_ENABLE_DRIVER_VICAR
    OGR_ENABLE_DRIVER_AVCBIN
    OGR_ENABLE_DRIVER_AVCE00
    OGR_ENABLE_DRIVER_DGNV8
    OGR_ENABLE_DRIVER_EEDA
    OGR_ENABLE_DRIVER_ELASTICSEARCH
    OGR_ENABLE_DRIVER_ESRIJSON
    OGR_ENABLE_DRIVER_GEOJSONSEQ
    OGR_ENABLE_DRIVER_GRASS
    OGR_ENABLE_DRIVER_INTERLIS1
    OGR_ENABLE_DRIVER_INTERLIS2
    OGR_ENABLE_DRIVER_MEMORY
    OGR_ENABLE_DRIVER_NETCDF
    OGR_ENABLE_DRIVER_OAPIF
    OGR_ENABLE_DRIVER_PDF
    OGR_ENABLE_DRIVER_POSTGRESQL
    OGR_ENABLE_DRIVER_TOPOJSON
    OGR_ENABLE_DRIVER_UKNTF

Are these drivers that haven't been ported to CMake yet? Or are they non-existent drivers that should be removed from the docs?

Operating system

macOS 12.3.1 Apple M1 Pro

GDAL version and provenance

GDAL 3.5.0 built from source using Spack

P.S. Let me know if any GDAL devs would be interested in helping me maintain our Spack build recipe for GDAL!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions