]> SALOME platform Git repositories - tools/configuration.git/commitdiff
Salome HOME
Another merge from oscar/imps_2017 (from GUI module), clean redundant code in check... V8_5_0b1
authorvsr <vsr@opencascade.com>
Mon, 9 Apr 2018 10:43:26 +0000 (13:43 +0300)
committervsr <vsr@opencascade.com>
Mon, 9 Apr 2018 10:43:26 +0000 (13:43 +0300)
cmake/FindQwt.cmake

index e4993611b1c7febbb1a86407d04503d6d6f3e2b0..fcb1c0dd78a6213a0e9f40afa28b4a129926a90a 100644 (file)
 #
 #  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")
@@ -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<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)