[gdal-dev] GDAL_COMPILATION and standalone plugins
Andrew C Aitchison
gdal at aitchison.me.uk
Wed Mar 25 06:30:19 PDT 2026
When should GDAL_COMPILATION be set ?
I would like a source tree for a driver.
Ideally it would be possible to build this in tree (both
as a plugin or compiled into libgdal.so) and standalone against
an existing gdal installation (with development libraries and headers).
I thought that GDAL_COMPILATION was a way to tell whether my driver
was being built as part of gdal, but I find that
cmake/helpers/SetupStandalonePlugin.cmake includes
cmake/helpers/GdalCompilationFlags.cmake which sets GDAL_COMPILATION
Why do I care ?
An in tree build will declare my GDALRegister function in
gcore/gdal_frmts.h
(since it will be used in
frmts/gdalallregister.cpp
) but an out of tree build will need to declare this itself.
I thought that testing GDAL_COMPILATION would be the way to avoid my
GDALRegister function being declared twice under some circumstances.
Any idea what I am missing or misunderstanding ?
Thanks,
--
Andrew C. Aitchison Kendal, UK
andrew at aitchison.me.uk
More information about the gdal-dev
mailing list