From eca7de1725f48901aa9711bfc15d1fcc0122fea9 Mon Sep 17 00:00:00 2001
From: Christoph Pohl <christoph.pohl@kit.edu>
Date: Thu, 4 Jan 2024 11:06:35 +0100
Subject: [PATCH] Copy changes of Findqwt from simox

---
 etc/cmake/Findqwt.cmake | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/etc/cmake/Findqwt.cmake b/etc/cmake/Findqwt.cmake
index 7eb71ba7..b7204f50 100644
--- a/etc/cmake/Findqwt.cmake
+++ b/etc/cmake/Findqwt.cmake
@@ -3,24 +3,26 @@ if (qwt_INCLUDE_DIR AND qwt_LIBRARIES)
     set(qwt_FOUND TRUE)
 else()
     if (NOT qwt_DIR)
-        set(qwt_DIR $ENV{QWT_DIR})
+        if (DEFINED ENV{QWT_DIR})
+            set(qwt_DIR $ENV{QWT_DIR})
+        elseif (DEFINED ENV{qwt_DIR})
+            set(qwt_DIR $ENV{qwt_DIR})
+        endif()
     endif (NOT qwt_DIR)
     find_path(qwt_INCLUDE_DIR qwt.h
-        # installation selected by user
-        ${qwt_DIR}
-        ${qwt_DIR}/src
-        ${qwt_DIR}/include
-        /usr/include/qwt
+            # installation selected by user
+            ${qwt_DIR}
+            ${qwt_DIR}/src
+            ${qwt_DIR}/include
+            /usr/include/qwt
     )
 
     message(STATUS "qwt_DIR: ${qwt_DIR}")
     message(STATUS "qwt-Include: ${qwt_INCLUDE_DIR}")
 
-    set(qwtlibname qwt-qt5)
-
     find_library(qwt_LIBRARY
-                 NAMES ${qwtlibname}
-                 PATHS ${qwt_DIR}/lib)
+            NAMES qwt qwt-qt5
+            PATHS ${qwt_DIR}/lib)
     message(STATUS "qwt-lib: ${qwt_LIBRARY}")
 
     set(qwt_LIBRARIES ${qwt_LIBRARY})
-- 
GitLab