CMakeLists.txt: Respect FT_DISABLE_ZLIB value

The CMake build uses `find_package` to look for dependencies. Before calling `find_package` it looks to see if the dependency was disabled. If not the associated `_FOUND` variable will be set. This value is then checked to determine if the dependency is added.

However `find_package(PNG)` calls `find_package(ZLIB)` within its find module. So in the case of `FT_DISABLE_ZLIB=TRUE` and `FT_DISABLE_PNG=FALSE` the `ZLIB_FOUND` value can be set and even though `FT_DISABLE_ZLIB` is turned on.

Unset the value of `ZLIB_FOUND` after the call to `find_package(PNG)` so the value is only set when `FT_DISABLE_ZLIB` is turned off.
This commit is contained in:
Don Olmstead 2024-06-28 17:34:05 +00:00
parent bab9564a97
commit 2280346192
1 changed files with 2 additions and 0 deletions

View File

@ -265,6 +265,8 @@ if (NOT FT_DISABLE_PNG)
else ()
find_package(PNG)
endif ()
# FreePNG calls FindZLIB so unset ZLIB_FOUND to respect FT_DISABLE_ZLIB
unset(ZLIB_FOUND)
endif ()
if (NOT FT_DISABLE_ZLIB)