Re: GDAL_COMPILATION and standalone plugins

Even Rouault via gdal-dev <[email protected]>
Newsgroups gmane.comp.gis.gdal.devel
Message-ID <[email protected]>
Andrew,

You can redefine safely the definition of your GDALRegisterXXXX() 
function in your driver code (prvided you use the same signature as in 
gdal_frmts.h of course)

GDAL_COMPILATION is used to protect "private" GDAL functions that we 
don't want external users of the C++ API to be able to access.

As cmake/helpers/SetupStandalonePlugin.cmake is designed for code that 
is in the GDAL source code tree, it is logical it sets GDAL_COMPILATION

Even

Le 25/03/2026 à 14:30, Andrew C Aitchison via gdal-dev a écrit :
>
> 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,
>
-- 
http://www.spatialys.com
My software is free, but my time generally not.

_______________________________________________
gdal-dev mailing list
[email protected]
https://lists.osgeo.org/mailman/listinfo/gdal-dev
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.