Salome HOME
Merge branch 'ASL_TREE_STATE' into asl/hydro_porting_741
[modules/gui.git] / adm_local / cmake_files / FindQwt.cmake
index a144663457286398928359ee44621d4e8a1f111b..13ba70ef9e180be7af1d74c956088573930d44cb 100644 (file)
@@ -1,24 +1,9 @@
-# - Find Qwt installation
-# Sets the following variables:
-#   QWT_LIBRARY         - path to the Qwt library
-#   QWT_INCLUDE_DIR     - path to the Qwt headers
-#
-#  The header qwt_plot.h is looked for.
-#  The libraries 
-#      qwt-qt4, qwt
-#  are looked for.
-#
-
-#########################################################################
-# Copyright (C) 2007-2013  CEA/DEN, EDF R&D, OPEN CASCADE
-#
-# Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+# Copyright (C) 2013-2014  CEA/DEN, EDF R&D, OPEN CASCADE
 #
 # This library is free software; you can redistribute it and/or
 # modify it under the terms of the GNU Lesser General Public
 # License as published by the Free Software Foundation; either
-# version 2.1 of the License.
+# version 2.1 of the License, or (at your option) any later version.
 #
 # This library is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
 
+# - Find Qwt installation
+# Sets the following variables:
+#   QWT_LIBRARY         - path to the Qwt library
+#   QWT_INCLUDE_DIR     - path to the Qwt headers
+#
+#  The header qwt_plot.h is looked for.
+#  The libraries 
+#      qwt-qt4, qwt
+#  are looked for.
+#
+
 IF(NOT Qwt_FIND_QUIETLY)
     MESSAGE(STATUS "Looking for Qwt ...")
 ENDIF()
@@ -43,12 +39,20 @@ IF(WIN32)
   SET(QWT_DEFINITIONS "-DQWT_DLL")
   
   IF(CMAKE_BUILD_TYPE STREQUAL Debug)
-    FIND_LIBRARY(QWT_LIBRARY qwtd5)
-  ELSE()
-    FIND_LIBRARY(QWT_LIBRARY qwt5)
+    FIND_LIBRARY(QWT_LIBRARY qwtd)
   ENDIF()
+  FIND_LIBRARY(QWT_LIBRARY qwt)
 ELSE(WIN32)
-  # Give precedence to qwt-qt4 library:
+  # Give precedence to qwt-qt4 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)
+  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 PATH_SUFFIXES lib lib64)