Skip to content

cmake: initialize SDLIMAGE_APNG_ENABLED unconditionally - #764

Merged
madebr merged 1 commit into
libsdl-org:mainfrom
GEvangelinos:fix-apng-uninitialized-warning
Sep 11, 2026
Merged

madebr merged 1 commit into
libsdl-org:mainfrom
GEvangelinos:fix-apng-uninitialized-warning

Conversation

@GEvangelinos

@GEvangelinos GEvangelinos commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor
  • I confirm that I am the author of this code and release it to the SDL project under the zlib license. This contribution does not contain code from other sources, including code generated by a Large Language Model ("AI").

Description

When configuring with -DSDLIMAGE_PNG=OFF -Wdev, CMake triggers an AUTHOR_WARNING:

CMake Warning (dev) at CMakeLists.txt:1374 (message):
  SDLIMAGE_APNG_ENABLED not defined

APNG is unconditionally appended to SDLIMAGE_BACKENDS, but set(SDLIMAGE_APNG_ENABLED FALSE) was nested inside if(SDLIMAGE_PNG). When PNG is disabled, the reporting loop encounters an undefined variable.

Moving set(SDLIMAGE_APNG_ENABLED FALSE) outside the conditional ensures the variable is always defined.

When configured with -DSDLIMAGE_PNG=OFF -Wdev, an AUTHOR_WARNING is
triggered because SDLIMAGE_APNG_ENABLED was only set inside
if(SDLIMAGE_PNG).

Since APNG is unconditionally added to SDLIMAGE_BACKENDS, its enabled
variable must always be defined for the backend reporting loop.
@madebr
madebr merged commit e34aec8 into libsdl-org:main Sep 11, 2026
@madebr

madebr commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

Merged, thanks for the pull request!

Pushed to 3.4.x as a324e90

@GEvangelinos
GEvangelinos deleted the fix-apng-uninitialized-warning branch September 11, 2026 21:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants