]> granicus.if.org Git - graphviz/commitdiff
CMake: avoid referencing 'EXPAT_FOUND' when 'with_expat' is not set
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Sat, 5 Nov 2022 21:05:01 +0000 (14:05 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Tue, 8 Nov 2022 04:52:51 +0000 (20:52 -0800)
CMake when using `--warn-uninitialized -Werror=dev` notices that this variable
is being incorrectly referenced when `-Dwith_expat=OFF`:

  CMake Error (dev) at cmake/config_checks.cmake:40 (set):
    uninitialized variable 'EXPAT_FOUND'
  Call Stack (most recent call first):
    CMakeLists.txt:197 (include)

Gitlab: #2291

cmake/config_checks.cmake

index 4b9ab3e0c4bb3281dae4968fd6f07e8539cf9ee1..e9a6ed6acf34e37c3fa03471e8ecca8c47c883a3 100644 (file)
@@ -37,7 +37,9 @@ check_type_size( intptr_t    INTPTR_T    )
 
 # Library checks
 set( HAVE_ANN       ${ANN_FOUND}        )
-set( HAVE_EXPAT     ${EXPAT_FOUND}      )
+if(with_expat AND EXPAT_FOUND)
+  set(HAVE_EXPAT 1)
+endif()
 set( HAVE_LIBGD     ${GD_FOUND}         )
 set( HAVE_ZLIB      ${ZLIB_FOUND}       )