libsdl-org / SDL_image

Image decoding for many popular formats for Simple Directmedia Layer.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

cmake build: SDL2IMAGE_DEPS_SHARED option doesn't work

Soapux opened this issue · comments

When setting SDL2IMAGE_DEPS_SHARED=OFF, it doesn't directly link to the image libraries like it should.

The (current) default configuration of SDL2_image is to not need any 3rd party dependencies.
If you configure with e.g. -DSDL2IMAGE_TIF=ON, then it will link to libtiff.

After configuring and building SDL2_image using the following commands:

cmake -S /path/to/SDL_image -B /tmp/SDL_image-build -GNinja -DSDL2IMAGE_DEPS_SHARED=OFF -DSDL2IMAGE_TIFF=ON
cmake --build /tmp/SDL_image-build/

objdump -x /tmp/SDL_image-build/libSDL2_image.so | grep NEEDED prints:

  NEEDED               libSDL2-2.0.so.0
  NEEDED               libtiff.so.5
  NEEDED               libc.so.6

You're right, it does work. I see what was tripping me up now. In the autotools build tiff, avif, webp are default to on, whereas in the cmake build they are off. So I just assumed they were on and when I turned off dynamic loading I expected them be show in the NEEDED section. Maybe the cmake build should match the autotools build in that respect. I'll close this. Thanks.

This is "fixed" in SDL3, and will also be backported for SDL2: #421