From: Matthew Fernandez Date: Sat, 5 Nov 2022 21:07:57 +0000 (-0700) Subject: CMake: avoid referencing 'ZLIB_FOUND' when 'with_zlib' is not set X-Git-Tag: 7.0.1~1^2~2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6569651fbc4a5d8a0d50f0a116225b2023f84d11;p=graphviz CMake: avoid referencing 'ZLIB_FOUND' when 'with_zlib' is not set CMake when using `--warn-uninitialized -Werror=dev` notices that this variable is being incorrectly referenced when `-Dwith_zlib=OFF`: CMake Error (dev) at cmake/config_checks.cmake:42 (set): uninitialized variable 'ZLIB_FOUND' Call Stack (most recent call first): CMakeLists.txt:197 (include) Gitlab: #2291 --- diff --git a/cmake/config_checks.cmake b/cmake/config_checks.cmake index e9a6ed6ac..135df6b5e 100644 --- a/cmake/config_checks.cmake +++ b/cmake/config_checks.cmake @@ -41,7 +41,9 @@ if(with_expat AND EXPAT_FOUND) set(HAVE_EXPAT 1) endif() set( HAVE_LIBGD ${GD_FOUND} ) -set( HAVE_ZLIB ${ZLIB_FOUND} ) +if(with_zlib AND ZLIB_FOUND) + set(HAVE_ZLIB 1) +endif() if(LTDL_FOUND) set(ENABLE_LTDL 1)