Building GDAL from source
Build requirements
The minimum requirements to build GDAL are:
CMake >= 3.16, and an associated build system (make, ninja, Visual Studio, etc.)
C99 compiler
C++17 compiler since GDAL 3.9 (C++11 in previous versions)
PROJ >= 6.3.1
Additional requirements to run the GDAL test suite are:
SWIG >= 4, for building bindings to other programming languages
Python >= 3.8
Python packages listed inautotest/requirements.txt
A number of optional libraries are also strongly recommended for most builds:SQLite3, expat, libcurl, zlib, libtiff, libgeotiff, libpng, libjpeg, etc.ConsultRaster drivers andVector drivers pages for informationon dependencies of optional drivers.
CMake (GDAL versions >= 3.5.0)
Since version 3.5.0, GDAL can be built using the CMake build system.With the CMake build system you can compile and install GDAL on more or less anyplatform. After unpacking the source distribution archive (or cloning the repository)step into the source tree:
cdgdal-{VERSION}
Create a build directory and step into it:
mkdirbuildcdbuild
From the build directory you can now configure CMake, build and install the binaries:
cmake..cmake--build.cmake--build.--targetinstall
Note
For a minimal build, add these options to the initialcmake
command:-DGDAL_BUILD_OPTIONAL_DRIVERS=OFF-DOGR_BUILD_OPTIONAL_DRIVERS=OFF
.To enable specific drivers, add-DGDAL_ENABLE_DRIVER_<driver_name>=ON
or-DOGR_ENABLE_DRIVER_<driver_name>=ON
.SeeSelection of drivers for more details.
Note
The--prefix/installation/prefix
option of CMake (>= 3.14) is supported since GDAL 3.7.0,but note that contrary to setting the CMAKE_INSTALL_PREFIX at configuration time,it will not result in the GDAL_DATA path to be hardcoded into the libgdal binary,and is thus not recommended. It is also not supported on Windows multi-configurationgenerator (such as VisualStudio).
If a dependency is installed in a custom location, specify thepaths to the include directory and the library:
cmake-DSQLite3_INCLUDE_DIR=/opt/SQLite/include-DSQLite3_LIBRARY=/opt/SQLite/lib/libsqlite3.so..
Alternatively, a custom prefix can be specified:
cmake-DCMAKE_PREFIX_PATH=/opt/SQLite..
It is strongly recommended (and sometimes compulsory) to specify paths on Windowsusing forward slashes as well, e.g.:c:/path/to/include
.
You can unset existing cached variables, by using the -U switch of cmake, for example with wildcards:
cmake..-UGDAL_USE_*
You can assemble dependency settings in a fileConfigUser.cmake
and use it with the -C option.The file contains set() commands that use the CACHE option. You can set for example a different namefor the shared lib,e.g.set(GDAL_LIB_OUTPUT_NAMEgdal_x64CACHESTRING""FORCE)
:
cmake..-CConfigUser.cmake
Warning
When iterating to configure GDAL to add/modify/remove dependencies,some cache variables can remain in CMakeCache.txt from previous runs, andconflict with new settings. If strange errors appear during cmake run,you may try removing CMakeCache.txt to start from a clean state.
Refer toUsing GDAL in CMake projects for how to use GDAL in a CMake project.
To uninstall GDAL, from the build directory (be careful: this does not restore the files that pre-existed to the last installation, but just removes the last installed files!)
cmake--build.--targetuninstall
Building on Windows
On Windows, one may need to specify generator:
cmake-G"Visual Studio 15 2017"..
Building on MacOS
On MacOS, there are a couple of libraries that do not function properly when the GDAL build requirements are installed using Homebrew.
TheApache Arrow library included in the current distribution of Homebrew is broken, and causes a detection issue. In order to build GDAL successfully, configure CMake to not find the Arrow package:
cmake-DCMAKE_DISABLE_FIND_PACKAGE_Arrow=ON..
Similarly, recent versions of Homebrew no longer bundleBoost with libkml, causing a failure to find Boost headers. You should either install Boost manually or disable libkml when building on MacOS:
cmake-DGDAL_USE_LIBKML=OFF..
CMake general configure options
Options to configure a CMake are provided using-D<var>=<value>
.All cached entries can be viewed usingcmake-LAH
from a build directory.
- BUILD_APPS=ON
Build applications. Default is ON.
- BUILD_SHARED_LIBS
Build GDAL library shared. Default is ON. See also the CMakedocumentation forBUILD_SHARED_LIBS.
- CMAKE_BUILD_TYPE
Choose the type of build, options are: None (default), Debug, Release,RelWithDebInfo, or MinSizeRel. See also the CMake documentation forCMAKE_BUILD_TYPE.
Note
A default build is not optimized without specifying
-DCMAKE_BUILD_TYPE=Release
(or similar) during configuration,or by specifying--configRelease
with CMakemulti-configuration build tools (see example below).
- CMAKE_C_COMPILER
C compiler. Ignored for some generators, such as Visual Studio.
- CMAKE_C_FLAGS
Flags used by the C compiler during all build types. This isinitialized by the
CFLAGS
environment variable.
- CMAKE_CXX_COMPILER
C++ compiler. Ignored for some generators, such as Visual Studio.
- CMAKE_CXX_FLAGS
Flags used by the C++ compiler during all build types. This isinitialized by the
CXXFLAGS
environment variable.
- CMAKE_INSTALL_PREFIX
Where to install the software.Default for Unix-like is
/usr/local/
.
- CMAKE_PREFIX_PATH
List of directories specifying installation prefixes to be searched whenexternal dependencies are looked for.
Starting with CMake 3.12, it is also possible to use a
<Packagename>_ROOT
variable to define the prefix for a particularpackage. Seehttps://cmake.org/cmake/help/latest/release/3.12.html?highlight=root#commands
- CMAKE_UNITY_BUILD=OFF
Added in version 3.9.
Default is OFF. This can be set to ON to build GDAL using thehttps://cmake.org/cmake/help/latest/variable/CMAKE_UNITY_BUILD.html feature.This helps speeding GDAL build times. This feature is still consideredexperimental for now, and could hide subtle bugs (we are not aware ofany at writing time though). We don't recommend it for mission criticalbuilds.
- ENABLE_IPO=OFF
Build library using the compiler'sinterprocedural optimization(IPO), if available, default OFF.
- GDAL_SET_INSTALL_RELATIVE_RPATH=OFF
Set to ON so that the rpath of installed binaries is written as a relativepath to the library. This option overrides theCMAKE_INSTALL_RPATHvariable, and assumes that theCMAKE_SKIP_INSTALL_RPATHvariable is not set.
- USE_CCACHE=ON
Whether cached build usingccache should be enabled.This defaults to ON whenccache is found.
- USE_PRECOMPILED_HEADER=OFF
Whether builds with precompiled headers should be enabled. This may speedup the build process. This is still a bit experimental, so it is disabled bydefault. It also cannot be enabled when using the Visual Studio C++ compiler.
Resource files embedding
Starting with GDAL 3.11, if a C23-compatible compiler is used, such asclang >= 19 or GCC >= 15, it is possible to embed resource files insidethe GDAL library, without relying on resource files to be available on the filesystem (such resource files are located through an hard-codedpath at build time in${CMAKE_INSTALL_PREFIX}/share/gdal
, or at run-timethrough theGDAL_DATA
configuration option).
The following CMake options control that behavior:
- EMBED_RESOURCE_FILES=ON/OFF
Added in version 3.11.
Default is OFF for shared library builds (BUILD_SHARED_LIBS=ON), and ONfor static library builds (BUILD_SHARED_LIBS=OFF).When ON, resource files needed by GDAL will be embedded into the GDAL libraryand/or relevant plugins.
- USE_ONLY_EMBEDDED_RESOURCE_FILES=ON/OFF
Added in version 3.11.
Even if EMBED_RESOURCE_FILES=ON, GDAL will still try to locate resourcefiles on the file system by default , and fallback to the embedded version ifnot found. By setting USE_ONLY_EMBEDDED_RESOURCE_FILES=ON, no attemptat locating resource files on the file system is made. Default is OFF.
CMake package dependent options
Generally speaking, packages (external dependencies) will be automatically found ifthey are in default locations used by CMake. This can also be tuned for examplewith theCMAKE_PREFIX_PATH
variable.
Starting with CMake 3.12, it is also possible to use a<Packagename>_ROOT
variable to define the prefix for a particularpackage. Seehttps://cmake.org/cmake/help/latest/release/3.12.html?highlight=root#commandsNote that the case of the package name matters for the _ROOT, _INCLUDE_DIRand _LIBRARY variables.
Most dependencies that would be found can also be disabled by setting thefollowing option:
- GDAL_USE_<Packagename_in_upper_case>:BOOL=ON/OFF
Control whether a found dependency can be used for the GDAL build.
Note that CMake will still attempt to detect a package even if it has been disabled.
It is also possible to ask GDAL to disable the use of any external dependency(besides the required one, PROJ) by default by setting the following option toOFF. Individual libraries shall then be enabled explicitly withGDAL_USE_<Packagename_in_upper_case>:BOOL=ON.
- GDAL_USE_EXTERNAL_LIBS:BOOL=ON/OFF
Defaults to ON. When set to OFF, all external dependencies (but mandatoryones) will be disabled, unless individually enabled withGDAL_USE_<Packagename_in_upper_case>:BOOL=ON.This option should be set before CMakeCache.txt is created. If it is setto OFF after CMakeCache.txt is created, then cmake should be reinvoked with"-UGDAL_USE_*" to cancel the activation of previously detected libraries.
Some of the GDAL dependencies (GEOTIFF, GIF, JPEG, JSONC, LERC, OPENCAD, PNG, QHULL, TIFF, ZLIB)have a copy of their source code inside the GDAL source code tree. It is possibleto enable this internal copy by setting the GDAL_USE_<Packagename_in_upper_case>_INTERNAL:BOOL=ONvariable. When set, this has precedence over the external library that may bedetected. The behavior can also be globally controlled with the following variable:
- GDAL_USE_INTERNAL_LIBS=ON/OFF/WHEN_NO_EXTERNAL
Control how internal libraries should be used.If set to ON, they will always be used.If set to OFF, they will never be used (unless individually enabled withGDAL_USE_<Packagename_in_upper_case>_INTERNAL:BOOL=ON)If set to WHEN_NO_EXTERNAL (default value), they will be used only if nocorresponding external library is found and enabled.This option should be set before CMakeCache.txt is created.
Note
Using together GDAL_USE_EXTERNAL_LIBS=OFF and GDAL_USE_INTERNAL_LIBS=OFFwill result in a CMake configuration failure, because the following libraries(either as external dependencies or using the internal copy) are at leastrequired: ZLIB, TIFF, GEOTIFF and JSONC. Enabling them as external or internallibraries is thus required.
Archive
libarchive is a library that supports a varietyof archive and compression formats. It might be used since GDAL 3.7 to enablethe/vsi7z/ virtual file system.
- ARCHIVE_INCLUDE_DIR
Path to an include directory with the
archive.h
header file.
- ARCHIVE_LIBRARY
Path to a shared or static library file.
- GDAL_USE_ARCHIVE=ON/OFF
Control whether to use libarchive. Defaults to ON when libarchive is found.
Armadillo
TheArmadillo C++ library is used to speed up computations related to theThin Plate Spline transformer. Seehttps://cmake.org/cmake/help/latest/module/FindArmadillo.htmlfor details.On Windows builds using Conda-Forge dependencies, the following packages may alsoneed to be installed:blasblas-devellibblaslibcblasliblapackliblapacke
- GDAL_USE_ARMADILLO=ON/OFF
Control whether to use Armadillo. Defaults to ON when Armadillo is found.
Arrow
TheApache Arrow C++ <https://github.com/apache/arrow/tree/master/cpp> libraryis required for the(Geo)Arrow IPC File Format / Stream and(Geo)Parquet drivers.Specify install prefix in theCMAKE_PREFIX_PATH
variable.
- GDAL_USE_ARROW=ON/OFF
Control whether to use Arrow. Defaults to ON when Arrow is found.
- ARROW_USE_STATIC_LIBRARIES=ON/OFF
Control whether to use statically built Arrow libraries. Defaults to OFF when Arrow is found.
basisu
TheBasis Universal <https://github.com/rouault/basis_universal/tree/cmake> libraryis required for theBASISU -- Basis Universal andKTX2 drivers.Specify install prefix in theCMAKE_PREFIX_PATH
variable orbasisu_ROOT
variable.
- GDAL_USE_BASISU=ON/OFF
Control whether to use basisu. Defaults to ON when basisu is found.
Blosc
Blosc is a library which offersa meta-compression, with different backends (LZ4, Snappy, Zlib, Zstd, etc.).It is used by theZarr driver.
- BLOSC_INCLUDE_DIR
Path to an include directory with the
blosc.h
header file.
- BLOSC_LIBRARY
Path to a shared or static library file.
- GDAL_USE_BLOSC=ON/OFF
Control whether to use Blosc. Defaults to ON when Blosc is found.
BRUNSLI
TheBrunsli JPEG repacking library, usedby theMRF -- Meta Raster Format driver.
- BRUNSLI_INCLUDE_DIR
Path to an include directory with the
brunsli/decode.h
andbrunsli\encode.h
header files.
- BRUNSLI_ENC_LIB
Path to the brunslienc-c library file.
- BRUNSLI_DEC_LIB
Path to the brunslidec-c library file.
- GDAL_USE_BRUNSLI=ON/OFF
Control whether to use BRUNSLI. Defaults to ON when Brunsli is found.
CFITSIO
TheC FITS I/O library is required for theFITS -- Flexible Image Transport System driver.It can be detected with pkg-config.
- CFITSIO_INCLUDE_DIR
Path to an include directory with the
fitsio.h
header file.
- CFITSIO_LIBRARY
Path to a shared or static library file.
- GDAL_USE_CFITSIO=ON/OFF
Control whether to use CFITSIO. Defaults to ON when CFITSIO is found.
Crnlib
Crnlib / crunch isrequired for theDDS -- DirectDraw Surface driver.
- Crnlib_INCLUDE_DIR
Path to Crnlib include directory with
crunch/crnlib.h
header.
- Crnlib_LIBRARY
Path to Crnlib library to be linked.
- GDAL_USE_CRNLIB=ON/OFF
Control whether to use Crnlib. Defaults to ON when Crnlib is found.
CURL
libcurl is required for all network accesses (HTTP, etc.).
- CURL_INCLUDE_DIR
Path to an include directory with the
curl
directory.
- CURL_LIBRARY_RELEASE
Path to a shared or static library file, such as
libcurl.so
,libcurl.lib
, or other name.
- CURL_USE_STATIC_LIBS=ON/OFF
Added in version 3.7.1.
Must be set to ON when linking against a static build of Curl.
- GDAL_USE_CURL=ON/OFF
Control whether to use Curl. Defaults to ON when Curl is found.
CryptoPP
TheCrypto++ library can be used for the RSA SHA256 signingfunctionality used by some authentication methods of Google Cloud. It might berequired to use theEEDAI - Google Earth Engine Data API Image images or use the/vsigs/ virtual filesystem.It is also required for the/vsicrypt/ virtual file system.
- CRYPTOPP_INCLUDE_DIR
Path to the base include directory.
- CRYPTOPP_LIBRARY_RELEASE
Path to a shared or static library file. A similar variable
CRYPTOPP_LIBRARY_DEBUG
can also be specified to a similar library forbuilding Debug releases.
- CRYPTOPP_USE_ONLY_CRYPTODLL_ALG=ON/OFF
Defaults to OFF. Might be required to set to ON when linking againstcryptopp.dll
- GDAL_USE_CRYPTOPP=ON/OFF
Control whether to use CryptoPP. Defaults to ON when CryptoPP is found.
Deflate
libdeflate is a compression librarywhich offers the lossless Deflate/Zip compression algorithm.It offers faster performance than ZLib, but is not a full replacement for it,consequently it must be used as a complement to ZLib.
- Deflate_INCLUDE_DIR
Path to an include directory with the
libdeflate.h
header file.
- Deflate_LIBRARY_RELEASE
Path to a shared or static library file. A similar variable
Deflate_LIBRARY_DEBUG
can also be specified to a similar library forbuilding Debug releases.
- GDAL_USE_DEFLATE=ON/OFF
Control whether to use Deflate. Defaults to ON when Deflate is found.
ECW
The Hexagon ECW SDK (closed source/proprietary) is required for theECW -- Enhanced Compressed Wavelets (.ecw) driver.Currently only support for ECW SDK 3.3 and 5.5 is offered.
For ECW SDK 5.5, ECW_ROOT or CMAKE_PREFIX_PATH should point to the directoryinto which there are include and lib subdirectories, typicallyending with ERDAS-ECW_JPEG_2000_SDK-5.5.0/Desktop_Read-Only.
- ECW_INCLUDE_DIR
Path to the include directory with the
NCSECWClient.h
header file.
- ECW_LIBRARY
Path to library file libNCSEcw
- ECWnet_LIBRARY
Path to library file libNCSCnet (only needed for SDK 3.3)
- ECWC_LIBRARY
Path to library file libNCSEcwC (only needed for SDK 3.3)
- NCSUtil_LIBRARY
Path to library file libNCSUtil (only needed for SDK 3.3)
- GDAL_USE_ECW=ON/OFF
Control whether to use ECW. Defaults to ON when ECW is found.
EXPAT
Expat is a stream-oriented XML parserlibrary which is required to enable XML parsing capabilities in an importantnumber of OGR drivers (GML, GeoRSS, GPX, KML, LVBAG, OSM, ODS, SVG, WFS, XSLX, etc.).It is strongly recommended. Other driver such as ILI or GMLAS may also requirethe XercesC library.
- EXPAT_INCLUDE_DIR
Path to the include directory with the
expat.h
header file.
- EXPAT_LIBRARY
Path to a shared or static library file.
- EXPAT_USE_STATIC_LIBS=ON/OFF
Added in version 3.7.1.
Must be set to ON when linking against a static build of Expat.
- GDAL_USE_EXPAT=ON/OFF
Control whether to use EXPAT. Defaults to ON when EXPAT is found.
ExprTk
ExprTk is amathematical expression parser and evaluation engine. It can be used by theVRT -- GDAL Virtual Format driver. Building with ExprTk may increase the size of theGDAL library by several megabytes.
- GDAL_USE_EXPRTK=ON/OFF
Control whether to use ExprTk. Defaults to OFF even if ExprTk is found.
- EXPRTK_INCLUDE_DIR
Path to the include directory with the
exprtk.hpp
header file.
FileGDB
TheFileGDB SDK (closed source/proprietary)is required for theESRI File Geodatabase (FileGDB) driver (not to be confused withtheESRI File Geodatabase vector (OpenFileGDB) driver that has no external requirements)
FileGDB_ROOT or CMAKE_PREFIX_PATH should point to the directory of the SDK.
- FileGDB_INCLUDE_DIR
Path to the include directory with the
FileGDBAPI.h
header file.
- FileGDB_LIBRARY
Path to library file
- FileGDB_LIBRARY_RELEASE
Path to Release library file (only used on Windows)
- FileGDB_LIBRARY_DEBUG
Path to Debug library file (only used on Windows)
- GDAL_USE_FILEGDB=ON/OFF
Control whether to use FileGDB. Defaults to ON when FileGDB is found.
FreeXL
TheFreeXL library is requiredfor theXLS - MS Excel format driver.
- FREEXL_INCLUDE_DIR
Path to an include directory with the
freexl.h
header file.
- FREEXL_LIBRARY
Path to a shared or static library file.
- GDAL_USE_FREEXL=ON/OFF
Control whether to use FreeXL. Defaults to ON when FreeXL is found.
FYBA
TheOpenFyba libraries are needed to build theNorwegian SOSI Standard driver.
- FYBA_INCLUDE_DIR
Path to an include directory with the
fyba.h
header file.
- FYBA_FYBA_LIBRARY
Path to a library file
fyba
- FYBA_FYGM_LIBRARY
Path to a library file
fygm
- FYBA_FYUT_LIBRARY
Path to a library file
fyut
- GDAL_USE_FYBA=ON/OFF
Control whether to use FYBA. Defaults to ON when FYBA is found.
GEOTIFF
It is required for theGTiff -- GeoTIFF File Format drivers, and a few other drivers.If not found, an internal copy of libgeotiff can be used.
- GEOTIFF_INCLUDE_DIR
Path to an include directory with the libgeotiff header files.
- GEOTIFF_LIBRARY_RELEASE
Path to a shared or static library file, such as
libgeotiff.so
,geotiff.lib
, or other name. A similar variableGEOTIFF_LIBRARY_DEBUG
can also be specified to a similar library forbuilding Debug releases.
- GDAL_USE_GEOTIFF=ON/OFF
Control whether to use external libgeotiff. Defaults to ON when external libgeotiff is found.
- GDAL_USE_GEOTIFF_INTERNAL=ON/OFF
Control whether to use internal libgeotiff copy. Defaults depends on GDAL_USE_INTERNAL_LIBS. When setto ON, has precedence over GDAL_USE_GEOTIFF=ON
GEOS
GEOS is a C++ library for performing operationson two-dimensional vector geometries. It is used as the backend for most geometryprocessing operations available in OGR (intersection, buffer, etc.).Thegeos-config
program can be used to detect it.
- GEOS_INCLUDE_DIR
Path to an include directory with the
geos_c.h
header file.
- GEOS_LIBRARY
Path to a shared or static library file (libgeos_c).
- GDAL_USE_GEOS=ON/OFF
Control whether to use GEOS. Defaults to ON when GEOS is found.
GIF
giflib is required for theGIF -- Graphics Interchange Format driver.If not found, an internal copy can be used.
- GIF_INCLUDE_DIR
Path to an include directory with the
gif_lib.h
header file.
- GIF_LIBRARY
Path to a shared or static library file.
- GDAL_USE_GIF=ON/OFF
Control whether to use external giflib. Defaults to ON when external giflib is found.
- GDAL_USE_GIF_INTERNAL=ON/OFF
Control whether to use internal giflib copy. Defaults depends on GDAL_USE_INTERNAL_LIBS. When setto ON, has precedence over GDAL_USE_GIF=ON
GTA
TheGTA library is required for theGTA - Generic Tagged Arrays driver.
- GTA_INCLUDE_DIR
Path to an include directory with the
gta/gta.h
header file.
- GTA_LIBRARY
Path to a shared or static library file.
- GDAL_USE_GTA=ON/OFF
Control whether to use GTA. Defaults to ON when GTA is found.
HEIF
TheHEIF (>= 1.1) library used by theHEIF / HEIC -- ISO/IEC 23008-12 High Efficiency Image File Format driver.It can be detected with pkg-config.
- HEIF_INCLUDE_DIR
Path to an include directory with the
libheif/heif.h
header file.
- HEIF_LIBRARY
Path to a shared or static library file.
- GDAL_USE_HEIF=ON/OFF
Control whether to use HEIF. Defaults to ON when HEIF is found.
HDF4
TheHDF4 C library is neededfor theHDF4 -- Hierarchical Data Format Release 4 (HDF4) driver.
- HDF4_INCLUDE_DIR
Path to an include directory with the
hdf.h
header file.
- HDF4_df_LIBRARY_RELEASE
Path to a shared or static
dfalt
ordf
library file. A similar variableHDF4_df_LIBRARY_DEBUG
can also be specified to a similar library forbuilding Debug releases.
- HDF4_mfhdf_LIBRARY_RELEASE
Path to a shared or static
mfhdfalt
ormfhdf
library file. A similar variableHDF4_mfhdf_LIBRARY_DEBUG
can also be specified to a similar library forbuilding Debug releases.
- HDF4_xdr_LIBRARY_RELEASE
Path to a shared or static
xdr
library file. A similar variableHDF4_xdr_LIBRARY_DEBUG
can also be specified to a similar library forbuilding Debug releases.It is generally not needed for Linux builds
- HDF4_szip_LIBRARY_RELEASE
Path to a shared or static
szip
library file. A similar variableHDF4_szip_LIBRARY_DEBUG
can also be specified to a similar library forbuilding Debug releases.It is generally not needed for Linux builds
- HDF4_COMPONENTS
The value of this option is a list which defaults to
df;mfhdf;xdr;szip
.It may be customized if the linking of HDF4 require different libraries,in which case HDF4_{comp_name}_LIBRARY_[RELEASE/DEBUG] variables will beavailable to configure the library file.
- GDAL_USE_HDF4=ON/OFF
Control whether to use HDF4. Defaults to ON when HDF4 is found.
HDF5
TheHDF5 C library is needed for theHDF5 -- Hierarchical Data Format Release 5 (HDF5) andBAG -- Bathymetry Attributed Grid drivers.The HDF5 CXX library is needed for theKEA driver.Thehttps://cmake.org/cmake/help/latest/module/FindHDF5.html module is used todetect the HDF5 library.
- GDAL_USE_HDF5=ON/OFF
Control whether to use HDF5. Defaults to ON when HDF5 is found.
- GDAL_ENABLE_HDF5_GLOBAL_LOCK=ON/OFF
Control whether to add a global lock around calls to HDF5 library. This isneeded if the HDF5 library is not built with thread-safety enabled and ifthe HDF5 driver is used in a multi-threaded way. On Unix, a heuristicstry to detect if the HDF5 library has been built with thread-safety enabledwhen linking against a HDF5 library. In other situations, the setting mustbe manually set when needed.
HDFS
TheHadoop File System native library is neededfor the/vsihdfs/ virtual file system.
- HDFS_INCLUDE_DIR
Path to an include directory with the
hdfs.h
header file.
- HDFS_LIBRARY
Path to a shared or static
hdfs
library file.
- GDAL_USE_HDFS=ON/OFF
Control whether to use HDFS. Defaults to ON when HDFS is found.
Iconv
TheIconv library is used to converttext from one encoding to another encoding.It is generally available as a system library for Unix-like systems. On Windows,GDAL can leverage the API of the operating system for a few base conversions,but using Iconv will provide additional capabilities.
- Iconv_INCLUDE_DIR
Path to an include directory with the
iconv.h
header file.
- Iconv_LIBRARY
Path to a shared or static library file.
- GDAL_USE_ICONV=ON/OFF
Control whether to use Iconv. Defaults to ON when Iconv is found.
IDB
The Informix DataBase Client SDK (closed source/proprietary) is needed to buildtheIDB driver.IDB_ROOT or CMAKE_PREFIX_PATH should point to the directory of the SDK.
- IDB_INCLUDE_DIR
Path to an include directory (typically ending with
incl
) with thec++/it.h
header file.
- IDB_IFCPP_LIBRARY
Path to a library file
ifc++
(typically in thelib/c++
sub directory)
- IDB_IFDMI_LIBRARY
Path to a library file
ifdmi
(typically in thelib/dmi
sub directory)
- IDB_IFSQL_LIBRARY
Path to a library file
ifsql
(typically in thelib/esql
sub directory)
- IDB_IFCLI_LIBRARY
Path to a library file
ifcli
(typically in thelib/cli
sub directory)
- GDAL_USE_IDB=ON/OFF
Control whether to use IDB. Defaults to ON when IDB is found.
JPEG
libjpeg is required for theJPEG -- JPEG JFIF File Format driver, and may be used by a fewother drivers (GPKG -- GeoPackage raster,MRF -- Meta Raster Format, internal libtiff, etc.)If not found, an internal copy of libjpeg (6b) can be used.Usinglibjpeg-turbo is highlyrecommended to get best performance.Seehttps://cmake.org/cmake/help/latest/module/FindJPEG.html for more detailson how the library is detected.
Note
When using libjpeg-turbo, JPEG_LIBRARY[_RELEASE/_DEBUG] should point to alibrary with libjpeg ABI, not TurboJPEG.Seehttps://libjpeg-turbo.org/About/TurboJPEG for the difference.
- JPEG_INCLUDE_DIR
Path to an include directory with the
jpeglib.h
header file.
- JPEG_LIBRARY_RELEASE
Path to a shared or static library file. A similar variable
JPEG_LIBRARY_DEBUG
can also be specified to a similar library forbuilding Debug releases.
- GDAL_USE_JPEG=ON/OFF
Control whether to use external libjpeg. Defaults to ON when external libjpeg is found.
- GDAL_USE_JPEG_INTERNAL=ON/OFF
Control whether to use internal libjpeg copy. Defaults depends on GDAL_USE_INTERNAL_LIBS. When setto ON, has precedence over GDAL_USE_JPEG=ON
- EXPECTED_JPEG_LIB_VERSION=number
Used with external libjpeg. number is for example 80, for libjpeg 8 ABI.This can be used to check a build time that the expected JPEG library isthe one that is included by GDAL.
JPEG12
libjpeg-12 bit can be used by theJPEG -- JPEG JFIF File Format,GTiff -- GeoTIFF File Format (when using internal libtiff),JPEG -- JPEG JFIF File Format,MRF -- Meta Raster Format andNITF -- National Imagery Transmission Format drivers to handleJPEG images with a 12 bit depth. It is only supported with the internal libjpeg (6b).This can be used independently of if for regular 8 bit JPEG an external or internallibjpeg is used.
- GDAL_USE_JPEG12_INTERNAL=ON/OFF
Control whether to use internal libjpeg-12 copy. Defaults to ON.
Note
Starting with GDAL 3.7, if using libjpeg-turbo >= 2.2, which adds nativesupport for dual 8/12-bit, using internal libjpeg-12 is no longer needed toget 12-bit JPEG support in the JPEG, MRF, NITF or GeoTIFF (when built withinternal libtiff) drivers. If using external libtiff, libtiff >= 4.5built against libjpeg-turbo >= 2.2 is needed to get 12-bit JPEG support in theGeoTIFF support.
JSON-C
Thejson-c library is required to read andwrite JSON content.It can be detected with pkg-config.If not found, an internal copy of json-c can be used.
- JSONC_INCLUDE_DIR
Path to an include directory with the
json.h
header file.
- JSONC_LIBRARY
Path to a shared or static library file.
- GDAL_USE_JSONC=ON/OFF
Control whether to use JSON-C. Defaults to ON when JSON-C is found.
- GDAL_USE_JSONC_INTERNAL=ON/OFF
Control whether to use internal JSON-C copy. Defaults depends on GDAL_USE_INTERNAL_LIBS. When setto ON, has precedence over GDAL_USE_JSONC=ON
JXL
Thelibjxl <https://github.com/libjxl/libjxl> library used by theGTiff -- GeoTIFF File Format driver, when built against internal libtiff.It can be detected with pkg-config.
- JXL_INCLUDE_DIR
Path to an include directory with the
jxl/decode.h
header file.
- JXL_LIBRARY
Path to a shared or static library file.
- GDAL_USE_JXL=ON/OFF
Control whether to use JXL. Defaults to ON when JXL is found.
KDU
The Kakadu library (proprietary) is required for theJP2KAK -- JPEG 2000 (based on Kakadu SDK) andJPIPKAK - JPIP Streaming drivers.There is no standardized installation layout, nor fixed library file names, so findingKakadu artifacts is a bit challenging. Currently automatic finding of it fromthe KDU_ROOT variable is only implemented for Linux, Mac and Windows x86_64builds. For other platforms, users need to manually specify the KDU_LIBRARYand KDU_AUX_LIBRARY variable.
- KDU_INCLUDE_DIR
Path to the root of the Kakadu build tree, from which the
coresys/common/kdu_elementary.h
header file should be found.
- KDU_LIBRARY
Path to a shared library file whose name is like libkdu_vXYR.so on Unixor kdu_vXYR.lib on Windows, where X.Y is the Kakadu version.
- KDU_AUX_LIBRARY
Path to a shared library file whose name is like libkdu_aXYR.so on Unixor kdu_aXYR.lib on Windows, where X.Y is the Kakadu version.
- GDAL_USE_KDU=ON/OFF
Control whether to use KDU. Defaults to ON when KDU is found.
KEA
TheKEA library is required for theKEAdriver. The HDF5 CXX library is also required.
- KEA_INCLUDE_DIR
Path to an include directory with the
libkea/KEACommon.h
header file.
- KEA_LIBRARY
Path to a shared or static library file.
- GDAL_USE_KEA=ON/OFF
Control whether to use KEA. Defaults to ON when KEA is found.
LERC
LERC is an open-source image or raster formatwhich supports rapid encoding and decoding for any pixel type (not just RGB or Byte).Users set the maximum compression error per pixel while encoding, so the precisionof the original input image is preserved (within user defined error bounds).
- LERC_INCLUDE_DIR
Path to an include directory with the
Lerc_c_api.h
header file.
- LERC_LIBRARY
Path to a shared or static library file.
- GDAL_USE_LERC=ON/OFF
Control whether to use LERC. Defaults to ON when LERC is found.
- GDAL_USE_LERC_INTERNAL=ON/OFF
Control whether to use the LERC internal library. Defaults depends on GDAL_USE_INTERNAL_LIBS. When setto ON, has precedence over GDAL_USE_LERC=ON
LIBAEC
libaec is a compression library which offersthe extended Golomb-Rice coding as defined in the CCSDS recommended standard 121.0-B-3.It is used by theGRIB -- WMO General Regularly-distributed Information in Binary form driver.
- LIBAEC_INCLUDE_DIR
Path to an include directory with the
libaec.h
header file.
- LIBAEC_LIBRARY
Path to a shared or static library file.
- GDAL_USE_LIBAEC=ON/OFF
Control whether to use LIBAEC. Defaults to ON when LIBAEC is found.
LibKML
LibKML is required for theLIBKML Driver (.kml .kmz) driver.It can be detected with pkg-config.
- LIBKML_INCLUDE_DIR
Path to the base include directory.
- LIBKML_BASE_LIBRARY
Path to a shared or static library file for
kmlbase
- LIBKML_DOM_LIBRARY
Path to a shared or static library file for
kmldom
- LIBKML_ENGINE_LIBRARY
Path to a shared or static library file for
kmlengine
- LIBKML_MINIZIP_LIBRARY
Path to a shared or static library file for
minizip
- LIBKML_URIPARSER_LIBRARY
Path to a shared or static library file for
uriparser
- GDAL_USE_LIBKML=ON/OFF
Control whether to use LibKML. Defaults to ON when LibKML is found.
LibLZMA
LibLZMA is a compression library which offersthe lossless LZMA2 compression algorithm.It is used by the internal libtiff library or theZarr driver.
- LIBLZMA_INCLUDE_DIR
Path to an include directory with the
lzma.h
header file.
- LIBLZMA_LIBRARY
Path to a shared or static library file.
- GDAL_USE_LIBLZMA=ON/OFF
Control whether to use LibLZMA. Defaults to ON when LibLZMA is found.
libOpenDRIVE
libOpenDRIVE in version >= 0.6.0 is required for theXODR -- OpenDRIVE Road Description Format driver.
- OpenDrive_DIR
Path to libOpenDRIVE CMake configuration directory
<installDir>/cmake/
. Thecmake/
path is usually automatically created when installing libOpenDRIVE and contains the necessary configuration files for inclusion into other project builds.
- GDAL_USE_OPENDRIVE=ON/OFF
Control whether to use libOpenDRIVE. Defaults to ON when libOpenDRIVE is found.
LibQB3
TheQB3 compression, usedby theMRF -- Meta Raster Format driver.
- GDAL_USE_LIBQB3=ON/OFF
Control whether to use LibQB3. Defaults to ON when LibQB3 is found.
LibXml2
TheLibXml2 processing library is used to do validation of XML files againsta XML Schema (.xsd) in a few drivers (PDF, GMLAS, GML OGR VRT) and for advancedcapabilities in GMLJP2v2 generation.
- LIBXML2_INCLUDE_DIR
Path to the base include directory.
- LIBXML2_LIBRARY
Path to a shared or static library file.
- GDAL_USE_LIBXML2=ON/OFF
Control whether to use LibXml2. Defaults to ON when LibXml2 is found.
LZ4
LZ4 is a compression library which offersthe lossless LZ4 compression algorithm.It is used by theZarr driver.
- LZ4_INCLUDE_DIR
Path to an include directory with the
lz4.h
header file.
- LZ4_LIBRARY_RELEASE
Path to a shared or static library file. A similar variable
LZ4_LIBRARY_DEBUG
can also be specified to a similar library forbuilding Debug releases.
- GDAL_USE_LZ4=ON/OFF
Control whether to use LZ4. Defaults to ON when LZ4 is found.
MONGOCXX
TheMongoCXX and BsonCXX librariesare needed to build theMongoDBv3 driver.They can be detected with pkg-config.
- MONGOCXX_INCLUDE_DIR
Path to an include directory with the
mongocxx/client.hpp
header file.
- BSONCXX_INCLUDE_DIR
Path to an include directory with the
bsoncxx/config/version.hpp
header file.
- MONGOCXX_LIBRARY
Path to a library file
mongocxx
- BSONCXX_LIBRARY
Path to a library file
bsoncxx
- GDAL_USE_MONGOCXX=ON/OFF
Control whether to use MONGOCXX. Defaults to ON when MONGOCXX is found.
MRSID
The MRSID Raster DSDK (closed source/proprietary) is required for theMrSID -- Multi-resolution Seamless Image Database driver.
MRSID_ROOT or CMAKE_PREFIX_PATH should point to the directory of the SDK ending withRaster_DSDK. Note that on Linux, its lib subdirectory should be in theLD_LIBRARY_PATH so that the linking of applications succeeds and libtbb.so canbe found.
- MRSID_INCLUDE_DIR
Path to the include directory with the
lt_base.h
header file.
- MRSID_LIBRARY
Path to library file libltidsdk
- GDAL_ENABLE_DRIVER_JP2MRSID
Whether to enable JPEG2000 support through the MrSID SDK. The default valueof this option is OFF.
- GDAL_USE_MRSID=ON/OFF
Control whether to use MRSID. Defaults to ON when MRSID is found.
MSSQL_NCLI
The Microsoft SQL Native Client Library (closed source/proprietary) is requiredto enable bulk copy in theMSSQLSpatial - Microsoft SQL Server Spatial Database driver.If both MSSQL_NCLI and MSSQL_ODBC are found and enabled, MSSQL_ODBC will be used.The library is normally found if installed in standard location, and at version 11.
- MSSQL_NCLI_VERSION
Major version of the Native Client, typically 11
- MSSQL_NCLI_INCLUDE_DIR
Path to include directory with
sqlncli.h
header.
- MSSQL_NCLI_LIBRARY
Path to library to be linked.
- GDAL_USE_MSSQL_NCLI=ON/OFF
Control whether to use MSSQL_NCLI. Defaults to ON when MSSQL_NCLI is found.
MSSQL_ODBC
The Microsoft SQL Native ODBC driver Library (closed source/proprietary) is requiredto enable bulk copy in theMSSQLSpatial - Microsoft SQL Server Spatial Database driver.If both MSSQL_NCLI and MSSQL_ODBC are found and enabled, MSSQL_ODBC will be used.The library is normally found if installed in standard location, and at version 17.
- MSSQL_ODBC_VERSION
Major version of the Native Client, typically 17
- MSSQL_ODBC_INCLUDE_DIR
Path to include directory with
msodbcsql.h
header.
- MSSQL_ODBC_LIBRARY
Path to library to be linked.
- GDAL_USE_MSSQL_ODBC=ON/OFF
Control whether to use MSSQL_ODBC. Defaults to ON when MSSQL_ODBC is found.
muparser
muparser is a mathematical expressionparser and evaluation engine. It can be used by theVRT -- GDAL Virtual Format driver.
- GDAL_USE_MUPARSER=ON/OFF
Control whether to use muparser. Defaults to ON when muparser is found.
- MUPARSER_INCLUDE_DIR
Path to directory with muparser headers.
- MUPARSER_LIBRARY
Path to library to be linked.
MYSQL
The MySQL or MariaDB client library is required to enable theMySQLdriver.
- MYSQL_INCLUDE_DIR
Path to include directory with
mysql.h
header file.
- MYSQL_LIBRARY
Path to library to be linked.
- GDAL_USE_MYSQL=ON/OFF
Control whether to use MYSQL. Defaults to ON when MYSQL is found.
NetCDF
ThenetCDF is required to enable theNetCDF: Network Common Data Form driver.Thenc-config
program can be used to detect it.
- NETCDF_INCLUDE_DIR
Path to an include directory with the
netcdf.h
header file.
- NETCDF_LIBRARY
Path to a shared or static library file.
- GDAL_USE_NETCDF=ON/OFF
Control whether to use netCDF. Defaults to ON when netCDF is found.
ODBC
ODBC is required for various drivers:ODBC RDBMS,ESRI Personal GeoDatabase,SAP HANA andMSSQLSpatial - Microsoft SQL Server Spatial Database.It is normally automatically found in system directories on Unix and Windows.
- ODBC_INCLUDE_DIR
Path to ODBC include directory with
sql.h
header.
- ODBC_LIBRARY
Path to ODBC library to be linked.
- GDAL_USE_ODBC=ON/OFF
Control whether to use ODBC. Defaults to ON when ODBC is found.
ODBC-CPP
Theodbc-cpp-wrapper library is required fortheSAP HANA driver.
- ODBCCPP_INCLUDE_DIR
Path to an include directory with the
odbc/Environment.h
header file.
- ODBCCPP_LIBRARY
Path to a shared or static library file.
- GDAL_USE_ODBCCPP=ON/OFF
Control whether to use ODBC-CPP. Defaults to ON when ODBC-CPP is found.
OpenCAD
libopencad is required for theCAD -- AutoCAD DWGdriver. If not found, an internal copy can be used.
- OPENCAD_INCLUDE_DIR
Path to an include directory with the
opencad.h
header file.
- OPENCAD_LIBRARY
Path to a shared or static library file.
- GDAL_USE_OPENCAD=ON/OFF
Control whether to use external libopencad. Defaults to ON when external libopencad is found.
- GDAL_USE_OPENCAD_INTERNAL=ON/OFF
Control whether to use internal libopencad copy. Defaults depends on GDAL_USE_INTERNAL_LIBS. When setto ON, has precedence over GDAL_USE_OPENCAD=ON
OpenEXR
OpenEXR is required for theEXR -- Extended Dynamic Range Image File Format driver
SpecifyOpenEXR_ROOT
variable pointing to the parent directory of/lib and /include subdirectories, i.e. /DEV/lib/openexr-3.0.For OpenEXR >= 3 additionally specifyImath_ROOT
as this is aseparate library now, i.e. /DEV/lib/imath-3.1.3
or
Specify root directory adding to theCMAKE_PREFIX_PATH
variable to find OpenEXR's pkgconfig.For example -DCMAKE_PREFIX_PATH=/DEV/lib/openexr-3.0;/DEV/lib/imath-3.1.3
or
Get real specific and setOpenEXR_INCLUDE_DIR
,Imath_INCLUDE_DIR
,OpenEXR_LIBRARY
,OpenEXR_UTIL_LIBRARY
,OpenEXR_HALF_LIBRARY
,OpenEXR_IEX_LIBRARY
explicitly
- GDAL_USE_OPENEXR=ON/OFF
Control whether to use OpenEXR. Defaults to ON when OpenEXR is found.
OpenJPEG
TheOpenJPEG library is an open-sourceJPEG-2000 codec written in C language. It is required for theJP2OpenJPEG -- JPEG2000 driver based on OpenJPEG library driver, or other drivers that use JPEG-2000 functionality.
- OPENJPEG_INCLUDE_DIR
Path to an include directory with the
openjpeg.h
header file.
- OPENJPEG_LIBRARY
Path to a shared or static library file.
- GDAL_USE_OPENJPEG=ON/OFF
Control whether to use OpenJPEG. Defaults to ON when OpenJPEG is found.
- GDAL_FIND_PACKAGE_OpenJPEG_MODE=MODULE/CONFIG/emptystring
Added in version 3.9.
Control the mode used for find_package(OpenJPEG). Defaults to MODULEfor compatibility with OpenJPEG < 2.5.1. If set to CONFIG, only Config modesearch is attempted. If set to empty string, default CMake logic(https://cmake.org/cmake/help/latest/command/find_package.html) applies.
OpenSSL
The Crypto component of theOpenSSL librarycan be used for the RSA SHA256 signing functionality used by some authenticationmethods of Google Cloud. It might be required to use theEEDAI - Google Earth Engine Data API Imageimages or use the/vsigs/ virtual file system.
Seehttps://cmake.org/cmake/help/latest/module/FindOpenSSL.html for details onhow to configure the library. For static linking, the following options maybe needed: -DOPENSSL_USE_STATIC_LIBS=TRUE -DOPENSSL_MSVC_STATIC_RT=TRUE
- GDAL_USE_OPENSSL=ON/OFF
Control whether to use OpenSSL. Defaults to ON when OpenSSL is found.
Oracle
The Oracle Instant Client SDK (closed source/proprietary) is required for theOracle Spatial and theOracle Spatial GeoRaster drivers
- Oracle_ROOT
Path to the root directory of the Oracle Instant Client SDK.
- GDAL_USE_ORACLE=ON/OFF
Control whether to use Oracle. Defaults to ON when Oracle is found.
Parquet
The Parquet component of theApache Arrow C++ <https://github.com/apache/arrow/tree/master/cpp>library is required for the(Geo)Parquet driver.Specify install prefix in theCMAKE_PREFIX_PATH
variable.
- GDAL_USE_PARQUET=ON/OFF
Control whether to use Parquet. Defaults to ON when Parquet is found.
- ARROW_USE_STATIC_LIBRARIES=ON/OFF
Control whether to use statically built Arrow libraries. Defaults to OFF when Parquet is found.
PCRE2
PCRE2 implements Perl-compatibleRegular Expressions support. It is used for the REGEXP operator in drivers using SQLite3.
- PCRE2_INCLUDE_DIR
Path to an include directory with the
pcre2.h
header file.
- PCRE2_LIBRARY
Path to a shared or static library file with "pcre2-8" in its name.
- GDAL_USE_PCRE2=ON/OFF
Control whether to use PCRE2. Defaults to ON when PCRE2 is found.
PDFIUM
ThePDFium library is oneof the possible backends for thePDF -- Geospatial PDF driver.
- PDFIUM_INCLUDE_DIR
Path to an include directory with the
public/fpdfview.h
header file.
- PDFIUM_LIBRARY
Path to a shared or static library file.
- GDAL_USE_PDFIUM=ON/OFF
Control whether to use PDFIUM. Defaults to ON when PDFIUM is found.
PNG
libpng is required for thePNG -- Portable Network Graphicsdriver, and may be used by a few other drivers (GRIB -- WMO General Regularly-distributed Information in Binary form,GPKG -- GeoPackage raster, etc.)If not found, an internal copy of libpng can be used.Seehttps://cmake.org/cmake/help/latest/module/FindPNG.html for more detailson how the library is detected.
- PNG_PNG_INCLUDE_DIR
Path to an include directory with the
png.h
header file.
- PNG_LIBRARY_RELEASE
Path to a shared or static library file. A similar variable
PNG_LIBRARY_DEBUG
can also be specified to a similar library forbuilding Debug releases.
- GDAL_USE_PNG=ON/OFF
Control whether to use external libpng. Defaults to ON when external libpng is found.
- GDAL_USE_PNG_INTERNAL=ON/OFF
Control whether to use internal libpng copy. Defaults depends on GDAL_USE_INTERNAL_LIBS. When setto ON, has precedence over GDAL_USE_PNG=ON
Poppler
ThePoppler library is oneof the possible backends for thePDF -- Geospatial PDF driver.
Note that GDAL requires Poppler private headers, that are only installedif configuring Poppler with -DENABLE_UNSTABLE_API_ABI_HEADERS.
- Poppler_INCLUDE_DIR
Path to an include directory with the
poppler-config.h
header file.
- Poppler_LIBRARY
Path to a shared or static library file.
- GDAL_USE_POPPLER=ON/OFF
Control whether to use Poppler. Defaults to ON when Poppler is found.
PostgreSQL
ThePostgreSQL client library is required forthePostgreSQL / PostGIS andPostGISRaster -- PostGIS Raster driver drivers.
- PostgreSQL_INCLUDE_DIR
Path to an include directory with the
libpq-fe.h
header file.
- PostgreSQL_LIBRARY_RELEASE
Path to a shared or static library file
pq
/libpq
. A similar variablePostgreSQL_LIBRARY_DEBUG
can also be specified to a similar library forbuilding Debug releases.
- GDAL_USE_POSTGRESQL=ON/OFF
Control whether to use PostgreSQL. Defaults to ON when PostgreSQL is found.
PROJ
PROJ >= 6.3 is arequired dependency for GDAL.
- PROJ_INCLUDE_DIR
Path to an include directory with the
proj.h
header file.
- PROJ_LIBRARY_RELEASE
Path to a shared or static library file, such as
libproj.so
,proj.lib
, or other name. A similar variablePROJ_LIBRARY_DEBUG
can also be specified to a similar library forbuilding Debug releases.
- GDAL_FIND_PACKAGE_PROJ_MODE=CUSTOM/MODULE/CONFIG/emptystring
Added in version 3.9.
Control the mode used for find_package(PROJ).Alters how the default CMake search logic(https://cmake.org/cmake/help/latest/command/find_package.html) applies.Defaults to CUSTOM, where the CONFIG mode is applied for PROJ >= 8, andfallbacks to default MODULE mode otherwise.Other values are passed directly to find_package()
QHULL
TheQHULL library is used for the linearinterpolation of gdal_grid. If not found, an internal copy can be used.
- QHULL_PACKAGE_NAME
Name of the pkg-config package, typically
qhull_r
orqhullstatic_r
. Defaults toqhull_r
- QHULL_INCLUDE_DIR
Path to an include directory with the
libqhull_r/libqhull_r.h
header file.
- QHULL_LIBRARY
Path to a shared or static library file to the reentrant library.
- GDAL_USE_QHULL=ON/OFF
Control whether to use QHULL. Defaults to ON when QHULL is found.
- GDAL_USE_QHULL_INTERNAL=ON/OFF
Control whether to use internal QHULL copy. Defaults depends on GDAL_USE_INTERNAL_LIBS. When setto ON, has precedence over GDAL_USE_QHULL=ON
RASTERLITE2
TheRasterLite2 (>= 1.1.0)library used by theRasterLite2 - Rasters in SQLite DB driver.It can be detected with pkg-config.
- RASTERLITE2_INCLUDE_DIR
Path to an include directory with the
rasterlite2/rasterlite2.h
header file.
- RASTERLITE2_LIBRARY
Path to a shared or static library file.
- GDAL_USE_RASTERLITE2=ON/OFF
Control whether to use RasterLite2. Defaults to ON when RasterLite2 is found.
SPATIALITE
TheSpatialite libraryused by theSQLite / Spatialite RDBMS andGPKG -- GeoPackage vector drivers, and theSQL SQLite dialect.It can be detected with pkg-config.
- SPATIALITE_INCLUDE_DIR
Path to an include directory with the
spatialite.h
header file.
- SPATIALITE_LIBRARY
Path to a shared or static library file.
- GDAL_USE_SPATIALITE=ON/OFF
Control whether to use Spatialite. Defaults to ON when Spatialite is found.
SQLite3
TheSQLite3 library is required for theSQLite / Spatialite RDBMS andGPKG -- GeoPackage vector drivers (and also used by other drivers),and theSQL SQLite dialect.
- SQLite3_INCLUDE_DIR
Path to an include directory with the
sqlite3.h
header file.
- SQLite3_LIBRARY
Path to a shared or static library file, such as
libsqlite3.so
,sqlite3.lib
or other name.
- GDAL_USE_SQLITE3=ON/OFF
Control whether to use SQLite3. Defaults to ON when SQLite3 is found.
SFCGAL
SFCGAL is a geometry library whichsupports ISO 19107:2013 and OGC Simple Features Access 1.2 for 3D operations(PolyhedralSurface, TINs, ...)
- SFCGAL_INCLUDE_DIR
Path to the base include directory.
- SFCGAL_LIBRARY_RELEASE
Path to a shared or static library file. A similar variable
SFCGAL_LIBRARY_DEBUG
can also be specified to a similar library forbuilding Debug releases.
- GDAL_USE_SFCGAL=ON/OFF
Control whether to use SFCGAL. Defaults to ON when SFCGAL is found.
SWIG
SWIG is a software development tool that connectsprograms written in C and C++ with a variety of high-level programming languages.It is used for the Python, Java and CSharp bindings.
- SWIG_EXECUTABLE
Path to the SWIG executable.
Note that setting it explicitly might be needed, and that putting thedirectory of the installed binary into the PATH might not be sufficient.The reason is that when building from source, a "swig" binary will begenerated, but FindSWIG will prefer a "swig-4.0" binary if found elsewherein the PATH.
TEIGHA
The TEIGHA / Open Design Alliance libraries (closed source/proprietary) arerequired for theAutoCAD DWG andMicrostation DGN v8 drivers.Note that on Linux, with a SDK consisting of shared libraries,the bin/{platform_name} subdirectory of the SDK should be in the LD_LIBRARY_PATHso that the linking of applications succeeds.The TEIGHA_ROOT variable must be set.
- TEIGHA_ROOT
Path to the base directory where the Kernel and Drawings package must beextracted.
- TEIGHA_ACTIVATION_FILE_DIRECTORY
Path to a directory where a
OdActivationInfo
file is located. If thefile is somewhere under TEIGHA_ROOT, it will be automatically discovered.Otherwise this variable must be set for recent SDK versions (at least with2021 and later).
- GDAL_USE_TEIGHA=ON/OFF
Control whether to use TEIGHA. Defaults to ON when TEIGHA is found.
TIFF
libtiff is required for theGTiff -- GeoTIFF File Format drivers, and a few other drivers.If not found, an internal copy of libtiff can be used.
- TIFF_INCLUDE_DIR
Path to an include directory with the
tiff.h
header file.
- TIFF_LIBRARY_RELEASE
Path to a shared or static library file, such as
libtiff.so
,tiff.lib
, or other name. A similar variableTIFF_LIBRARY_DEBUG
can also be specified to a similar library forbuilding Debug releases.
- GDAL_USE_TIFF=ON/OFF
Control whether to use external libtiff. Defaults to ON when external libtiff is found.
- GDAL_USE_TIFF_INTERNAL=ON/OFF
Control whether to use internal libtiff copy. Defaults depends on GDAL_USE_INTERNAL_LIBS. When setto ON, has precedence over GDAL_USE_TIFF=ON
TileDB
TheTileDB <https://github.com/TileDB-Inc/TileDB> library is required for theTileDB - TileDB raster driver.Specify install prefix in theCMAKE_PREFIX_PATH
variable.
TileDB >= 2.15 is required since GDAL 3.9
- GDAL_USE_TILEDB=ON/OFF
Control whether to use TileDB. Defaults to ON when TileDB is found.
WebP
WebP is a image compression library.It is required for theWEBP - WEBP driver, and may be used by theGPKG -- GeoPackage raster and the internal libtiff library.
- WEBP_INCLUDE_DIR
Path to an include directory with the
webp/encode.h
header file.
- WEBP_LIBRARY
Path to a shared or static library file.
- GDAL_USE_WEBP=ON/OFF
Control whether to use WebP. Defaults to ON when WebP is found.
XercesC
Xerces-C is a stream-oriented XML parserlibrary which is required to enable XML parsing capabilities in theNAS - ALKIS,"INTERLIS 1" and "INTERLIS 2" drivers andGMLAS - Geography Markup Language (GML) driven by application schemas drivers.It can also be used as an alternative to Expat for the GML driver.
- XercesC_INCLUDE_DIR
Path to the base include directory.
- XercesC_LIBRARY
Path to a shared or static library file.
- GDAL_USE_XERCESC=ON/OFF
Control whether to use XercesC. Defaults to ON when XercesC is found.
ZLIB
ZLib is a compression library which offersthe lossless Deflate/Zip compression algorithm.
- ZLIB_INCLUDE_DIR
Path to an include directory with the
zlib.h
header file.
- ZLIB_LIBRARY_RELEASE
Path to a shared or static library file. A similar variable
ZLIB_LIBRARY_DEBUG
can also be specified to a similar library forbuilding Debug releases.
- ZLIB_IS_STATIC
Link to static external ZLIB directory.Only used if GDAL_USE_ZLIB_INTERNAL=OFF and MSVC.
- GDAL_USE_ZLIB=ON/OFF
Control whether to use ZLIB. Defaults to ON when ZLIB is found.
- GDAL_USE_ZLIB_INTERNAL=ON/OFF
Control whether to use internal zlib copy. Defaults depends on GDAL_USE_INTERNAL_LIBS. When setto ON, has precedence over GDAL_USE_ZLIB=ON
ZSTD
ZSTD is a compression library which offersthe lossless ZStd compression algorithm (faster than Deflate/ZIP, but incompatiblewith it). It is used by the internal libtiff library or theZarr driver.
- ZSTD_INCLUDE_DIR
Path to an include directory with the
zstd.h
header file.
- ZSTD_LIBRARY
Path to a shared or static library file.
- GDAL_USE_ZSTD=ON/OFF
Control whether to use ZSTD. Defaults to ON when ZSTD is found.
Selection of drivers
By default, all drivers that have their build requirements satisfied will bebuilt-in in the GDAL core library.
The following options are available to select a subset of drivers:
- GDAL_ENABLE_DRIVER_<driver_name>:BOOL=ON/OFF
- OGR_ENABLE_DRIVER_<driver_name>:BOOL=ON/OFF
Independently of options that control global behavior, drivers can be individuallyenabled or disabled with those options.
Note
<driver_name> above and below isgenerally, but not systematically the short driver name.
Some drivers may also be grouped together for build purposes.
A number of "raw" raster drivers (ACE2, BT, BYN, CPG, CTable2, DIPEx, DOQ1,DOQ2, EHDR, EIR, ENVI, FAST, GenBIN, GSC, GTX, MFF2, ISCE, KRO, MFF, LAN,LCP, LOSLAS, NDF, NTv2, PAUX, PNM, ROIPAC, RRASTER, SNODAS) are controlledby the GDAL_ENABLE_DRIVER_RAW option.
Planetary raster formats (PDS, PDS4, ISIS2, ISIS3, VICAR) are controlled bythe GDAL_ENABLE_DRIVER_PDS option.
The AAIGRID, GRASSASCIIGRID and ISG raster drivers are controlled by the GDAL_ENABLE_DRIVER_AAIGRID option.
The ECW and JP2ECW raster drivers are controlled by the GDAL_ENABLE_DRIVER_ECW option.
The vector EEDA and raster EEDAI drivers are controlled by the GDAL_ENABLE_DRIVER_EEDA option.
The GSAG, GSBG and GS7BG raster drivers are controlled by the GDAL_ENABLE_DRIVER_GSG option.
The HDF5 and BAG raster drivers are controlled by the GDAL_ENABLE_DRIVER_HDF5 option.
The MrSID and JP2MrSID raster drivers are controlled by the GDAL_ENABLE_DRIVER_MRSID option.
The NITF, RPFTOC and ECRGTOC raster drivers are controlled by the GDAL_ENABLE_DRIVER_NITF option.
The NWT_GRD and NWT_GRC raster drivers are controlled by the GDAL_ENABLE_DRIVER_NORTHWOOD option.
The SRP and ADRG raster drivers are controlled by the GDAL_ENABLE_DRIVER_ADRG option.
The Interlis 1 and Interlis 2 vector drivers are controlled by the GDAL_ENABLE_DRIVER_ILI option.
The WFS and OAPIF vector drivers are controlled by the GDAL_ENABLE_DRIVER_WFS option.
The AVCBIN and AVCE00 vector drivers are controlled by the GDAL_ENABLE_DRIVER_AVC option.
The DWG and DGNv8 vector drivers are controlled by the GDAL_ENABLE_DRIVER_DWG option.
There might be variations in naming, e.g. :
the "AIG" raster driver is controlled by GDAL_ENABLE_DRIVER_AIGRID.
the "ESAT" raster driver is controlled by GDAL_ENABLE_DRIVER_ENVISAT.
the "GeoRaster" raster driver is controlled by GDAL_ENABLE_DRIVER_GEOR.
the "RST" raster driver is controlled by GDAL_ENABLE_DRIVER_IDRISI.
the "ElasticSearch" vector driver is controlled by OGR_ENABLE_DRIVER_ELASTIC.
the "PostgreSQL" vector driver is controlled by OGR_ENABLE_DRIVER_PG.
the "UK .NTF" vector driver is controlled by OGR_ENABLE_DRIVER_NTF.
Note
Drivers that have both a raster and vector side (and are internally implemented by asingle GDALDriver instance) are controlled by either a GDAL_ENABLE_DRIVER_<driver_name>option or a OGR_ENABLE_DRIVER_<driver_name> one, but not both:
The CAD drivers are controlled by the OGR_ENABLE_DRIVER_CAD option.
The netCDF drivers are controlled by the GDAL_ENABLE_DRIVER_NETCDF option.
The PDF drivers are controlled by the GDAL_ENABLE_DRIVER_PDF option.
The GPKG drivers are controlled by the OGR_ENABLE_DRIVER_GPKG option.
The NGW drivers are controlled by the OGR_ENABLE_DRIVER_NGW option.
The SQLite drivers are controlled by the OGR_ENABLE_DRIVER_SQLITE option.
Note
The GDAL_ENABLE_DRIVER_<driver_name> and OGR_ENABLE_DRIVER_<driver_name> options areonly created when their required dependencies are found.
- GDAL_BUILD_OPTIONAL_DRIVERS:BOOL=ON/OFF
- OGR_BUILD_OPTIONAL_DRIVERS:BOOL=ON/OFF
Globally enable/disable all optional GDAL/raster, resp. all optional OGR/vector drivers.More exactly, setting those variables to ON affect the default value of the
GDAL_ENABLE_DRIVER_<driver_name>
orOGR_ENABLE_DRIVER_<driver_name>
variables(when they are not yet set).This can be combined with individual activation of a subset of drivers by usingthe
GDAL_ENABLE_DRIVER_<driver_name>:BOOL=ON
orOGR_ENABLE_DRIVER_<driver_name>:BOOL=ON
variables. Note that changing the value of GDAL_BUILD_OPTIONAL_DRIVERS/OGR_BUILD_OPTIONAL_DRIVERS after a first run of CMake does not change theactivation of individual drivers. It might be needed to pass-UGDAL_ENABLE_DRIVER_*-UOGR_ENABLE_DRIVER_*
to reset their state.Note
The following GDAL drivers cannot be disabled: VRT, DERIVED, GTiff, COG, HFA, MEM.The following OGR drivers cannot be disabled: "ESRI Shapefile", "MapInfo File", OGR_VRT, Memory, KML, GeoJSON, GeoJSONSeq, ESRIJSON, TopoJSON.
Note
Disabling all OGR/vector drivers with -DOGR_BUILD_OPTIONAL_DRIVERS=OFF may affectthe ability to enable some GDAL/raster drivers that require some vectordrivers to be enabled (and reciprocally with some GDAL/raster drivers dependingon vector drivers).When such dependencies are not met, a CMake error will be emitted with a hintfor the way to resolve the issue.It is also possible to anticipate such errors by looking at filesCMakeLists.txt for dependencies of raster driversandCMakeLists.txt for dependencies of vector drivers.
Example of minimal build with the JP2OpenJPEG and SVG drivers enabled:
cmake..-UGDAL_ENABLE_DRIVER_*-UOGR_ENABLE_DRIVER_* \-DGDAL_BUILD_OPTIONAL_DRIVERS:BOOL=OFF-DOGR_BUILD_OPTIONAL_DRIVERS:BOOL=OFF \-DGDAL_ENABLE_DRIVER_JP2OPENJPEG:BOOL=ON \-DOGR_ENABLE_DRIVER_SVG:BOOL=ON
Build drivers as plugins
An important subset, but not all, drivers can be also built as plugin, that isto say as standalone .dll/.so shared libraries, to be installed in thegdalplugins
subdirectory of the GDAL installation. This can be useful in particular fordrivers that depend on libraries that have a license different (proprietary, copyleft, ...)from the core GDAL library.
The list of drivers that can be built as plugins can be obtained with:
cmake..-L|grep-e"_ENABLE.*PLUGIN"
The following options are available to select the plugin/builtin status ofa driver:
- GDAL_ENABLE_DRIVER_<driver_name>_PLUGIN:BOOL=ON/OFF
- OGR_ENABLE_DRIVER_<driver_name>_PLUGIN:BOOL=ON/OFF
Independently of options that control global behavior, drivers can be individuallyenabled or disabled with those options.
Note that for the driver to be built, the corresponding base
GDAL_ENABLE_DRIVER_{driver_name}:BOOL=ON
orOGR_ENABLE_DRIVER_{driver_name}:BOOL=ON
option mustbe set.
- GDAL_ENABLE_PLUGINS:BOOL=ON/OFF
Globally enable/disable building all (plugin capable), GDAL and OGR, drivers as plugins.More exactly, setting that variable to ON affects the default value of the
GDAL_ENABLE_DRIVER_<driver_name>_PLUGIN
orOGR_ENABLE_DRIVER_<driver_name>_PLUGIN
variables (when they are not yet set).This can be combined with individual activation/deactivation of the plugin status with the
GDAL_ENABLE_DRIVER_{driver_name}_PLUGIN:BOOL
orOGR_ENABLE_DRIVER_{driver_name}_PLUGIN:BOOL
variables.Note that changing the value of GDAL_ENABLE_PLUGINS after a firstrun of CMake does not change the activation of the plugin status of individual drivers.It might be needed to pass-UGDAL_ENABLE_DRIVER_*-UOGR_ENABLE_DRIVER_*
to reset their state.
Example of build with all potential drivers as plugins, except the JP2OpenJPEG one:
cmake..-UGDAL_ENABLE_DRIVER_*-UOGR_ENABLE_DRIVER_* \-DGDAL_ENABLE_PLUGINS:BOOL=ON \-DGDAL_ENABLE_DRIVER_JP2OPENJPEG_PLUGIN:BOOL=OFF
There is a subtelty regardingGDAL_ENABLE_PLUGINS:BOOL=ON
. It only controlsthe plugin status of plugin-capable drivers that have external dependencies,that are not part of GDAL core dependencies (e.g. are netCDF, HDF4, Oracle, PDF, etc.).
- GDAL_ENABLE_PLUGINS_NO_DEPS:BOOL=ON/OFF
Globally enable/disable building all (plugin capable), GDAL and OGR, drivers as plugins,for drivers that have no external dependencies (e.g. BMP, FlatGeobuf), or that havedependencies that are part of GDAL core dependencies (e.g GPX).Building such drivers as plugins is generally not necessary, hencethe use of a different option from GDAL_ENABLE_PLUGINS.
In some circumstances, it might be desirable to prevent loading of GDAL plugins.This can be done with:
- GDAL_AUTOLOAD_PLUGINS:BOOL=ON/OFF
Set to OFF to disable loading of GDAL plugins. Default is ON.
Deferred loaded plugins
Starting with GDAL 3.9, a number of in-tree drivers, that can be built asplugins, are loaded in a deferred way. This involves that some part of theircode, which does not depend on external libraries, is included in core libgdal,whereas most of the driver code is in a separated dynamically loaded library.For builds where libgdal and its plugins are built in a single operation, thisis fully transparent to the user.
When a plugin driver is known of core libgdal, but not available as a plugin atruntime, GDAL will inform the user that the plugin is not available, but couldbe installed. It is possible to give more hints on how to install a pluginby setting the following option:
- GDAL_DRIVER_<driver_name>_PLUGIN_INSTALLATION_MESSAGE:STRING
- OGR_DRIVER_<driver_name>_PLUGIN_INSTALLATION_MESSAGE:STRING
Custom message to give a hint to the user how to install a missing plugin
For example, if doing a build with:
cmake..-DOGR_DRIVER_PARQUET_PLUGIN_INSTALLATION_MESSAGE="You may install it with with 'conda install -c conda-forge libgdal-arrow-parquet'"
and opening a Parquet file while the plugin is not installed will display thefollowing error:
$ ogrinfo poly.parquetERROR 4: `poly.parquet' not recognized as a supported file format. It could have been recognized by driver Parquet, but plugin ogr_Parquet.so is not available in your installation. You may install it with with 'conda install -c conda-forge libgdal-arrow-parquet'
For more specific builds where libgdal would be first built, and then plugindrivers built in later incremental builds, this approach would not work, giventhat the core libgdal built initially would lack code needed to declare theplugin(s).
In that situation, the user building GDAL will need to explicitly declare atinitial libgdal build time that one or several plugin(s) will be later built.Note that it is safe to distribute such a libgdal library, even if the pluginsare not always available at runtime.
This can be done with the following option:
- GDAL_REGISTER_DRIVER_<driver_name>_FOR_LATER_PLUGIN:BOOL=ON
- OGR_REGISTER_DRIVER_<driver_name>_FOR_LATER_PLUGIN:BOOL=ON
Declares that a driver will be later built as a plugin.
Setting this option to drivers not ready for it will lead to an explicitCMake error.
For some drivers (ECW, HEIF, JP2KAK, JPEG, JPEGXL, KEA, LERC, MrSID,MSSQLSpatial, netCDF, OpenJPEG, PDF, TileDB, WEBP), the metadata and/or datasetidentification code embedded on libgdal, will depend on optional capabilitiesof the dependent library (e.g. libnetcdf for netCDF)In that situation, it is desirable that the dependent library is available atCMake configuration time for the core libgdal built, but disabled withGDAL_USE_<driver_name>=OFF. It must of course be re-enabled later when the plugin isbuilt.
For example for netCDF:
cmake..-DGDAL_REGISTER_DRIVER_NETCDF_FOR_LATER_PLUGIN=ON-DGDAL_USE_NETCDF=OFFcmake--build.cmake..-DGDAL_USE_NETCDF=ON-DGDAL_ENABLE_DRIVER_NETCDF=ON-DGDAL_ENABLE_DRIVER_NETCDF_PLUGIN=ONcmake--build.--targetgdal_netCDF
For other drivers, GDAL_REGISTER_DRIVER_<driver_name>_FOR_LATER_PLUGIN /OGR_REGISTER_DRIVER_<driver_name>_FOR_LATER_PLUGIN can be declared atlibgdal build time without requiring the dependent libraries needed to buildthe plugin later to be available.
Out-of-tree deferred loaded plugins
Out-of-tree drivers can also benefit from the deferred loading capability, providedlibgdal is built with CMake variable(s) pointing to external code containing thecode for registering a proxy driver.
This can be done with the following option:
- ADD_EXTERNAL_DEFERRED_PLUGIN_<driver_name>:FILEPATH=/path/to/some/file.cpp
The pointed file must declare avoidDeclareDeferred<driver_name>(void)
method with C linkage that takes care of creating a GDALPluginDriverProxyinstance and callingGDALDriverManager::DeclareDeferredPluginDriver()
on it.
Python bindings options
- BUILD_PYTHON_BINDINGS:BOOL=ON/OFF
Whether Python bindings should be built. It is ON by default, but onlyeffective if a Python installation is found.
A nominal Python installation should comprise the Python runtime (>= 3.6) andthe setuptools module.numpy and its header and development library are also strongly recommended.
The Python installation is normally found if found in the path or registeredthrough other standard installation mechanisms of the Python installers.It is also possible to specify it using several variables, as detailed inhttps://cmake.org/cmake/help/git-stage/module/FindPython.html
GDAL also provides the following option:
- Python_LOOKUP_VERSION:STRING=major.minor.patch
When it is specified, Python_FIND_STRATEGY=VERSION is assumed. Note thatthe patch number must be provided, as the EXACT strategy is used
Other useful options:
- Python_FIND_VIRTUALENV
Specify 'ONLY' to use virtualenv activated.
- Python_ROOT
Specify Python installation prefix.
Examples:
cmake-DPython_LOOKUP_VERSION=3.6.0..cmake-DPython_FIND_VIRTUALENV=ONLY..cmake-DPython_ROOT=C:\Python36..
The following options are advanced ones and only taken into account duringtheinstall
CMake target.
- GDAL_PYTHON_INSTALL_PREFIX
This option can be specified to a directory name, to override the
CMAKE_INSTALL_PREFIX
option.It is used to set the value of the--prefix
option ofpython3setup.pyinstall
.
- GDAL_PYTHON_INSTALL_LAYOUT
This option can be specified to set the value of the
--install-layout
option ofpython3setup.pyinstall
. The install layout is by default set todeb
when it is detected that the Python installation looks forthesite-packages
subdirectory. Otherwise it is unspecified.
- GDAL_PYTHON_INSTALL_LIB
This option can be specified to set the value of the
--install-lib
option ofpython3setup.pyinstall
. It is only taken into account onMacOS systems, when the Python installation is a framework.
Note
The Python bindings are made of several modules (osgeo.gdal, osgeo.ogr, etc.)which link each against libgdal. Consequently, a static build of libgdal isnot compatible with the bindings.
Java bindings options
- BUILD_JAVA_BINDINGS:BOOL=ON/OFF
Whether Java bindings should be built. It is ON by default, but onlyeffective if Java runtime and development packages are found.The relevant options that can be set are described inhttps://cmake.org/cmake/help/latest/module/FindJava.html andhttps://cmake.org/cmake/help/latest/module/FindJNI.html.The
ant
binary must also be available in the PATH.
- GDAL_JAVA_INSTALL_DIR
Subdirectory into which to install the
gdal.jar
file.It defaults to "${CMAKE_INSTALL_DATADIR}/java"Note
Prior to GDAL 3.8, the gdalalljni library was also installed in thatdirectory. Starting with GDAL 3.8, this is controlled by the
GDAL_JAVA_JNI_INSTALL_DIR
variable.
- GDAL_JAVA_JNI_INSTALL_DIR
Added in version 3.8.
Subdirectory into which to install the
libgdalalljni.so
/libgdalalljni.dylib
/gdalalljni.dll
library.It defaults to "${CMAKE_INSTALL_LIBDIR}/jni".Note
Prior to GDAL 3.8, the gdalalljni library was installed in thedirectory controlled by the
GDAL_JAVA_INSTALL_DIR
variable.
Note
The Java bindings are made of several modules (org.osgeo.gdal, org.osgeo.ogr, etc.)which link each against libgdal. Consequently, a static build of libgdal isnot compatible with the bindings.
Option only to be used by maintainers:
- GPG_KEY
GPG key to sign build artifacts. Needed to generate bundle.jar.
- GPG_PASS
GPG pass phrase to sign build artifacts.
C# bindings options
For more details on how to build and use the C# bindings read the dedicated sectionCompiling the C# bindings - CMake Scripts.
- BUILD_CSHARP_BINDINGS:BOOL=ON/OFF
Whether C# bindings should be built. It is ON by default, but onlyeffective if C# runtime and development packages are found. Either .NETSDK can be used or Mono. The relevant options that can be set are describedin
cmake/modules/thirdparty/FindDotNetFrameworkSdk.cmake
andcmake/modules/thirdparty/FindMono.cmake
.
- CSHARP_MONO=ON/OFF
Forces the use of Mono as opposed to .NET to compile the C# bindings.
- CSHARP_LIBRARY_VERSION
Sets the .NET (or Mono) target SDK to be used when compiling the C# binding libraries.List of acceptable contents for .NET
- CSHARP_APPLICATION_VERSION
Sets the .NET (or Mono) target SDK to be used when compiling the C# sample applications.List of acceptable contents for .NET
- GDAL_CSHARP_ONLY=OFF/ON
Build the C# bindings without building GDAL. This should be used when building the bindings on top of an existing GDAL installation - for instance on top of the CONDA package.
Note
The C# bindings are made of several modules (OSGeo.GDAL, OSGeo.OGR, etc.)which link each against libgdal. Consequently, a static build of libgdal isnot compatible with the bindings.
Driver specific options
- GDAL_USE_PUBLICDECOMPWT
TheMSG -- Meteosat Second Generation driver is built only if this option is set to ON (default is OFF).Its effect is to download thehttps://gitlab.eumetsat.int/open-source/PublicDecompWT.gitrepository (requires the
git
binary to be available at configuration time)into the build tree and build the needed files from it into the driver.
Cross-compiling for Android
First refer tohttps://cmake.org/cmake/help/latest/manual/cmake-toolchains.7.html#cross-compiling-for-androidand tostart.sh foran example of a build script to cross-compile from Ubuntu.
Typical build issues
How do I get PROJ ?
PROJ is the only required build-time dependency of GDAL that is not vendorizedin the GDAL source code tree. Consequently, the PROJ header and library must be availablewhen configuring GDAL's CMake. ConsultPROJ installation.
Conflicting PROJ libraries
If using a custom PROJ build (that is a PROJ build that does not come froma distribution channel), it can sometimes happen that this custom PROJ buildconflicts with packaged dependencies, such as spatialite or libgeotiff, thatthemselves link to another copy of PROJ.
The clean way to solve this is to rebuild from sources those other librariesagainst the custom PROJ build.For Linux based systems, given that C API/ABI has been preserved in thePROJ 6, 7, 8, 9 series, if the custom PROJ build is more recent than thePROJ used by those other libraries, doing aliases of the olderlibproj.so.XX
name to the newerlibproj.so.YY
(withln-s
) should work, although it isdefinitely not recommended to use this solution in a production environment.
In any case, iflddlibgdal.so|greplibproj
reports more than one line,crashes will occur at runtime (often at process termination with amalloc_consolidate():invalidchunksize
and/orAborted(coredumped)
error message)
Autoconf/nmake (GDAL versions < 3.5.0)
Seehttp://web.archive.org/https://trac.osgeo.org/gdal/wiki/BuildHints for hints for GDAL < 3.5autoconf and nmake build systems.