OSGeo / gdal

GDAL is an open source MIT licensed translator library for raster and vector geospatial data formats.
https://gdal.org
Other
4.86k stars 2.53k forks source link

GEOS_LIBRARY can't accept list of libraries anymore #11014

Open psharma-gdal opened 1 week ago

psharma-gdal commented 1 week ago

What is the bug?

Refer to https://github.com/OSGeo/gdal/issues/5272

It seems that above issue was fixed and GEOS_LIBRARY was made to accept multiple libraries separated by semi-colon or colon . For e.g. GEOS_LIBRARY=D:\GEOS\lib\geos.lib;D:\GEOS\lib\geos_c.lib as CMake parameter

However while trying to build the latest release v3.9.3 i realize that its not working. The Windows CMAKE solution generated converts the ; into %3B and hence the build fails.

Steps to reproduce the issue

Try passing multiple geos libs as follows

<arg value="-DGEOS_LIBRARY=${unpack.dir}/geos/lib/geos.lib;${unpack.dir}/geos/lib/geos_c.lib" />

The windows solution generated has ; converted to %3B. I even tried below but same result

<arg value="-DGEOS_LIBRARY=&quot;${unpack.dir}/geos/lib/geos.lib;${unpack.dir}/geos/lib/geos_c.lib&quot;" />

Versions and provenance

Windows 11, Microsoft Visual studio 2022, CMake

Additional context

No response

rouault commented 1 week ago

This seems like impossible to do. Cf https://github.com/OSGeo/gdal/commit/608ad32404697028d2a91a7bc5fb74648ad39af5#commitcomment-147937952

psharma-gdal commented 1 week ago

This seems like impossible to do. Cf 608ad32#commitcomment-147937952

I am build GDAL v3.9.3 with GDAL_USE_GEOS=ON and linking statically with GEOS. In addition i am using GEOS_DIR, GEOS_LIBRARY and GEOS_INCLUDE_DIR flags.

I am getting linker errors which are resolved only when both geos_c.lib and geos.lib are added to linker inputs in the Visual Studio solutions generated.

However the CMAKE variable GEOS_LIBRARY isn't allowing to specify both the above geos libs. If i add both then semi-colon gets converted to %3B.

Are there any suggestions by which i could add both the geos libs to the linker input flags on GDAL project?

rouault commented 1 week ago

Using CMake config files rather than old school xxxx_LIBRARY is the way to go. You could also use the GDAL vcpkg builds which have various tunings to allow static linking: https://gdal.org/en/latest/download.html#vcpkg , https://github.com/microsoft/vcpkg/tree/master/ports/gdal