From a00775cdb47f55c34bd8400534dbb88bc5c5d87d Mon Sep 17 00:00:00 2001 From: Matthew Fernandez Date: Sat, 5 Nov 2022 11:59:52 -0700 Subject: [PATCH] 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 --- cmd/mingle/CMakeLists.txt | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) 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 -- 2.50.1