[gdal-dev] Build question: GDAL with libwebp....

Kai Pastor, DG0YT dg0yt at darc.de
Tue Feb 13 23:20:12 PST 2024


To pass lists into cmake, you usually need ';' as item separator.
(Exception: CMAKE_<lang>_FLAGS which is a command line fragment with 
space-separated items.)

In vcpkg, webp is configured via a CMAKE_PROJECT_INCLUDE file:

if(GDAL_USE_WEBP)
     find_package(WebP CONFIG REQUIRED)
     add_library(WEBP::WebP ALIAS WebP::webp)
     set(GDAL_CHECK_PACKAGE_WebP_NAMES WebP CACHE INTERNAL "vcpkg")
     set(GDAL_CHECK_PACKAGE_WebP_TARGETS WebP::webp CACHE INTERNAL "vcpkg")
endif()

Kai

Am 14.02.24 um 01:13 schrieb Carl Godkin via gdal-dev:
> Hi Andrew,
>
> Thanks for replying.  I am not looking for ways to edit CMakeLists.txt 
> files, especially since I don't really understand the syntax.
>
>  I was just hoping that someone who had built GDAL with WEBP enabled 
> would tell me how to specify both libraries to cmake on the command line.
>
> Sorry I over-complicated my question!
>
> carl
>
> On Tue, Feb 13, 2024 at 10:45 AM Andrew C Aitchison 
> <andrew at aitchison.me.uk> wrote:
>
>     On Tue, 13 Feb 2024, Carl Godkin via gdal-dev wrote:
>
>     > Hi,
>     >
>     > Sorry if this is an elementary cmake question but I am curious
>     if there is
>     > a cleaner solution than I came up with.
>     >
>     > I'm trying to build GDAL 3.8.3 with WEBP support.
>     >
>     > I built libwebp 1.3.2 (the latest) without any problems, also
>     using cmake.
>     >
>     > However, when building GDAL, the link on the shared library
>     fails since
>     > WEBP seems to require TWO libraries (in the libwebp package),
>     libwebp and
>     > libsharpyuv.
>     >
>     > My question is how can I persuade cmake to accept both libraries for
>     > WEBP_LIBRARY?
>     >
>     > I thought quotes would help.  What I think I ought to be able to
>     do is
>     > something like
>     >
>     >  -DWEBP_LIBRARY="/usr/local/devlibs/libwebp-1.3.2/lib64/libwebp.a
>     > /usr/local/devlibs/libwebp-1.3.2/lib64/libsharpyuv.a" \
>     >
>     > or else
>     >
>     >  "-DWEBP_LIBRARY=/usr/local/devlibs/libwebp-1.3.2/lib64/libwebp.a
>     > /usr/local/devlibs/libwebp-1.3.2/lib64/libsharpyuv.a" \
>     >
>     > but both options produce link lines that include the double
>     quotes!  This
>     > is an issue on Windows and Linux for me.
>
>     CMAKE is rather more verbose than that.
>
>     Compare
>         gdal/frmts/webp/CMakeLists.txt
>     with
>         gdal/frmts/png/CMakeLists.txt
>     for how the png driver uses libpng and zlib
>
>     You probably don't need the gdal_add_vendored_lib commands or the
>     GDAL_USE_..._INTERNAL tests, since gdal is not bundling libwebp.
>
>     > I have a couple of workarounds that I won't bore you with, but I was
>     > wondering what the best practice is here (other than
>     hand-editing the cmake
>     > output of course).
>     >
>     > I think that libwebp added the "sharpyuv" stuff at version 1.3.0
>     so perhaps
>     > using an older version would also work, but that doesn't seem
>     sustainable.
>     >
>     > Thanks for suggestions,
>     >
>     > carl
>     >
>
>     -- 
>     Andrew C. Aitchison                      Kendal, UK
>     andrew at aitchison.me.uk
>
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/gdal-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20240214/6bcbf4db/attachment.htm>


More information about the gdal-dev mailing list