Am 07.06.22 um 09:28 schrieb Even Rouault:
Note: If you really wanted to get the equivalent of GDAL_INCLUDE_DIRS and GDAL_LIBRARIES, you could use the following expressions:

$<TARGET_PROPERTY:GDAL::GDAL,INTERFACE_INCLUDE_DIRECTORIES>

$<TARGET_PROPERTY:GDAL::GDAL,INTERFACE_LINK_LIBRARIES>

It is not so trivial. $<TARGET_PROPERTY:GDAL::GDAL,INTERFACE_LINK_LIBRARIES>
- won't carry GDAL itself
- may use generator expressions (in particular for multi-config support)
- may use targets with transitive usage requirements (in particular for static builds)

GDAL has code to expand the tree of link libraries during the build for generating `gdal.pc`:
https://github.com/OSGeo/gdal/blob/master/cmake/helpers/GdalGenerateConfig.cmake

And so you might use pkg-config support in CMake to get something similar to the traditional GDAL_LIBRARIES.

If you need a value for GDAL_LIBRARIES without many changes, it may be enough to set it GDAL::GDAL.

Kai.

_______________________________________________
gdal-dev mailing list
[email protected]
https://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to