From: Matthew Fernandez Date: Sat, 5 Nov 2022 21:09:04 +0000 (-0700) Subject: CMake: avoid referencing 'EXPAT_INCLUDE_DIRS' unless Expat has been sought X-Git-Tag: 7.0.1~1^2~1 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=75a41811ba31633c68a8ab96ad0461072c12f153;p=graphviz CMake: avoid referencing 'EXPAT_INCLUDE_DIRS' unless Expat has been sought CMake when using `--warn-uninitialized -Werror=dev` notices that this variable is being incorrectly referenced when `-Dwith_expat=OFF`: CMake Error (dev) at lib/common/CMakeLists.txt:111 (target_include_directories): uninitialized variable 'EXPAT_INCLUDE_DIRS' Gitlab: #2291 --- diff --git a/lib/common/CMakeLists.txt b/lib/common/CMakeLists.txt index 3a167d483..796ed4297 100644 --- a/lib/common/CMakeLists.txt +++ b/lib/common/CMakeLists.txt @@ -108,9 +108,11 @@ target_include_directories(common_obj PRIVATE ../xdot ) -target_include_directories(common_obj SYSTEM PRIVATE - ${EXPAT_INCLUDE_DIRS} -) +if(EXPAT_FOUND) + target_include_directories(common_obj SYSTEM PRIVATE + ${EXPAT_INCLUDE_DIRS} + ) +endif() if(WIN32) target_include_directories(common_obj