From: Matthew Fernandez Date: Sat, 5 Nov 2022 18:59:52 +0000 (-0700) Subject: CMake: avoid use of 'GETOPT_INCLUDE_DIRS' when getopt has not been looked for X-Git-Tag: 7.0.1~1^2~8 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a00775cdb47f55c34bd8400534dbb88bc5c5d87d;p=graphviz CMake: avoid use of 'GETOPT_INCLUDE_DIRS' when getopt has not been looked for When running CMake with `--warn-uninitialized -Werror=dev`, this prevents the following: CMake Error (dev) at cmd/mingle/CMakeLists.txt:15 (target_include_directories): uninitialized variable 'GETOPT_INCLUDE_DIRS' Gitlab: #2291 --- diff --git a/cmd/mingle/CMakeLists.txt b/cmd/mingle/CMakeLists.txt index 3a8811349..077c63a6d 100644 --- a/cmd/mingle/CMakeLists.txt +++ b/cmd/mingle/CMakeLists.txt @@ -12,10 +12,12 @@ if(with_sfdp AND ANN_FOUND) ../../lib/common ) - target_include_directories(mingle - SYSTEM PRIVATE - ${GETOPT_INCLUDE_DIRS} - ) + if(GETOPT_FOUND) + target_include_directories(mingle + SYSTEM PRIVATE + ${GETOPT_INCLUDE_DIRS} + ) + endif() target_link_libraries(mingle cdt