FindGDAL¶
Deprecated since version 4.0: GDAL 3.5 and above provide a GDALConfig.cmake package configuration file.
Call find_package(GDAL CONFIG) to find it directly and avoid using this
find module. For further details, see GDAL's documentation on CMake
integration.
Finds Geospatial Data Abstraction Library (GDAL):
find_package(GDAL [<version>] [...])
Imported Targets¶
This module provides the following Imported Targets:
GDAL::GDALAdded in version 3.14.
Target encapsulating the GDAL usage requirements, available only if GDAL has been found.
Result Variables¶
This module defines the following variables:
GDAL_FOUNDBoolean indicating whether (the requested version of) GDAL was found.
GDAL_VERSIONAdded in version 3.14.
The version of GDAL found.
GDAL_INCLUDE_DIRSInclude directories for GDAL headers.
GDAL_LIBRARIESLibraries to link to GDAL.
Cache Variables¶
The following cache variables may also be set:
GDAL_INCLUDE_DIRThe directory containing
<gdal.h>.GDAL_LIBRARYThe libgdal library file.
Hints¶
The following variables may be set to modify the search strategy:
GDAL_DIRorGDAL_ROOTSet one of these environment variables to specify the GDAL installation prefix.
FindGDAL_SKIP_GDAL_CONFIGIf set,
gdal-configwill not be used. This can be useful if there are GDAL libraries built with autotools (which provide the tool) and CMake (which do not) in the same environment.GDAL_ADDITIONAL_LIBRARY_VERSIONSExtra versions of library names to search for.
Examples¶
Finding GDAL in config mode without using this module and linking its imported target to a project target:
find_package(GDAL CONFIG)
target_link_libraries(example PRIVATE GDAL::GDAL)