From d3fee0549d314b41536df5ee8751eeb2b99794aa Mon Sep 17 00:00:00 2001 From: vsr Date: Mon, 9 Apr 2018 13:43:26 +0300 Subject: [PATCH] Another merge from oscar/imps_2017 (from GUI module), clean redundant code in check qwt procedure --- cmake/FindQwt.cmake | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/cmake/FindQwt.cmake b/cmake/FindQwt.cmake index e499361..fcb1c0d 100644 --- a/cmake/FindQwt.cmake +++ b/cmake/FindQwt.cmake @@ -24,16 +24,26 @@ # # The header qwt_plot.h is looked for. # The libraries -# qwt-qt4, qwt +# qwt-qt, qwt # are looked for. +# Here, is a Qt version being used. +# For this to work correctly, Qt detection procedure must preceed Qwt one. # IF(NOT Qwt_FIND_QUIETLY) MESSAGE(STATUS "Looking for Qwt ...") ENDIF() +IF(QT_VERSION) + STRING(REPLACE "." ";" _qwt_qt_version_list ${QT_VERSION}) + LIST(GET _qwt_qt_version_list 0 _qwt_qt_version_major) +ELSE() + # by default use version 5 of Qt + SET(_qwt_qt_version_major "5") +ENDIF() + +FIND_PATH(QWT_INCLUDE_DIR qwt_plot.h PATH_SUFFIXES qwt-qt${_qwt_qt_version_major}) FIND_PATH(QWT_INCLUDE_DIR qwt_plot.h PATH_SUFFIXES qwt) -FIND_PATH(QWT_INCLUDE_DIR qwt_plot.h PATH_SUFFIXES qwt-qt4) IF(WIN32) SET(QWT_DEFINITIONS "-DQWT_DLL") @@ -43,18 +53,18 @@ IF(WIN32) ENDIF() FIND_LIBRARY(QWT_LIBRARY qwt) ELSE(WIN32) - # Give precedence to qwt-qt4 library. + # Give precedence to qwt-qt library. # Note: on some platforms there can be several native qwt libraries linked against different # versions of Qt; for example /usr/lib/libqwt.so for qwt linked against Qt 3 and - # /usr/lib/libqwt-qt4.so for qwt linked against Qt 4. - # We need only qt4-based qwt library, so we search libqwt-qt4, then libqwt library - # first ignoring system paths, then including system paths. - FIND_LIBRARY(QWT_LIBRARY qwt-qt4 PATH_SUFFIXES lib lib64 PATHS "${QWT_ROOT_DIR}" NO_DEFAULT_PATH) - FIND_LIBRARY(QWT_LIBRARY qwt-qt4 PATHS "${QWT_ROOT_DIR}" NO_DEFAULT_PATH) + # /usr/lib/libqwt-qt4.so for qwt linked against Qt 4, etc. + # We need only qwt library built with version of Qt we use, so we search libqwt-qt, + # then libqwt library; first ignoring system paths, then including system paths. + FIND_LIBRARY(QWT_LIBRARY qwt-qt${_qwt_qt_version_major} PATH_SUFFIXES lib lib64 PATHS "${QWT_ROOT_DIR}" NO_DEFAULT_PATH) + FIND_LIBRARY(QWT_LIBRARY qwt-qt${_qwt_qt_version_major} PATHS "${QWT_ROOT_DIR}" NO_DEFAULT_PATH) FIND_LIBRARY(QWT_LIBRARY qwt PATH_SUFFIXES lib lib64 PATHS "${QWT_ROOT_DIR}" NO_DEFAULT_PATH) FIND_LIBRARY(QWT_LIBRARY qwt PATHS "${QWT_ROOT_DIR}" NO_DEFAULT_PATH) - FIND_LIBRARY(QWT_LIBRARY qwt-qt4 PATH_SUFFIXES lib lib64) - FIND_LIBRARY(QWT_LIBRARY qwt-qt4) + FIND_LIBRARY(QWT_LIBRARY qwt-qt${_qwt_qt_version_major} PATH_SUFFIXES lib lib64) + FIND_LIBRARY(QWT_LIBRARY qwt-qt${_qwt_qt_version_major}) FIND_LIBRARY(QWT_LIBRARY qwt PATH_SUFFIXES lib lib64) FIND_LIBRARY(QWT_LIBRARY qwt) ENDIF(WIN32) -- 2.39.2