#
# The header qwt_plot.h is looked for.
# The libraries
-# qwt-qt4, qwt
+# qwt-qt<qt_version>, qwt
# are looked for.
+# Here, <qt_version> 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")
ENDIF()
FIND_LIBRARY(QWT_LIBRARY qwt)
ELSE(WIN32)
- # Give precedence to qwt-qt4 library.
+ # Give precedence to qwt-qt<version> 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<version>,
+ # 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)