Salome HOME
Updated copyright comment
[tools/configuration.git] / cmake / FindQwt.cmake
1 # Copyright (C) 2013-2024  CEA, EDF, OPEN CASCADE
2 #
3 # This library is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU Lesser General Public
5 # License as published by the Free Software Foundation; either
6 # version 2.1 of the License, or (at your option) any later version.
7 #
8 # This library is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 # Lesser General Public License for more details.
12 #
13 # You should have received a copy of the GNU Lesser General Public
14 # License along with this library; if not, write to the Free Software
15 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 #
17 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 #
19
20 # - Find Qwt installation
21 # Sets the following variables:
22 #   QWT_LIBRARY         - path to the Qwt library
23 #   QWT_INCLUDE_DIR     - path to the Qwt headers
24 #
25 #  The header qwt_plot.h is looked for.
26 #  The libraries 
27 #      qwt-qt<qt_version>, qwt
28 #  are looked for.
29 #  Here, <qt_version> is a Qt version being used.
30 #  For this to work correctly, Qt detection procedure must preceed Qwt one.
31 #
32
33 IF(NOT Qwt_FIND_QUIETLY)
34     MESSAGE(STATUS "Looking for Qwt ...")
35 ENDIF()
36
37 IF(QT_VERSION)
38   STRING(REPLACE "." ";" _qwt_qt_version_list ${QT_VERSION})
39   LIST(GET _qwt_qt_version_list 0 _qwt_qt_version_major)
40 ELSE()
41   # by default use version 5 of Qt
42   SET(_qwt_qt_version_major "5")
43 ENDIF()
44
45 FIND_PATH(QWT_INCLUDE_DIR qwt_plot.h PATH_SUFFIXES qwt-qt${_qwt_qt_version_major} qt${_qwt_qt_version_major}/qwt)
46 FIND_PATH(QWT_INCLUDE_DIR qwt_plot.h PATH_SUFFIXES qwt)
47
48 IF(WIN32)
49   SET(QWT_DEFINITIONS "-DQWT_DLL")
50   
51   IF(CMAKE_BUILD_TYPE STREQUAL Debug)
52     FIND_LIBRARY(QWT_LIBRARY qwtd)
53   ENDIF()
54   FIND_LIBRARY(QWT_LIBRARY qwt)
55 ELSE(WIN32)
56   # Give precedence to qwt-qt<version> library.
57   # Note: on some platforms there can be several native qwt libraries linked against different 
58   #       versions of Qt; for example /usr/lib/libqwt.so for qwt linked against Qt 3 and
59   #       /usr/lib/libqwt-qt4.so for qwt linked against Qt 4, etc.
60   #       We need only qwt library built with version of Qt we use, so we search libqwt-qt<version>,
61   #       then libqwt library; first ignoring system paths, then including system paths.
62   FIND_LIBRARY(QWT_LIBRARY qwt-qt${_qwt_qt_version_major} PATH_SUFFIXES lib lib64 PATHS "${QWT_ROOT_DIR}" NO_DEFAULT_PATH)
63   FIND_LIBRARY(QWT_LIBRARY qwt-qt${_qwt_qt_version_major} PATHS "${QWT_ROOT_DIR}" NO_DEFAULT_PATH)
64   FIND_LIBRARY(QWT_LIBRARY qwt PATH_SUFFIXES lib lib64 PATHS "${QWT_ROOT_DIR}" NO_DEFAULT_PATH)
65   FIND_LIBRARY(QWT_LIBRARY qwt PATHS "${QWT_ROOT_DIR}" NO_DEFAULT_PATH)
66   FIND_LIBRARY(QWT_LIBRARY qwt-qt${_qwt_qt_version_major} PATH_SUFFIXES lib lib64)
67   FIND_LIBRARY(QWT_LIBRARY qwt-qt${_qwt_qt_version_major})
68   FIND_LIBRARY(QWT_LIBRARY qwt PATH_SUFFIXES lib lib64)
69   FIND_LIBRARY(QWT_LIBRARY qwt)
70 ENDIF(WIN32)
71
72 INCLUDE(FindPackageHandleStandardArgs)
73 FIND_PACKAGE_HANDLE_STANDARD_ARGS(Qwt REQUIRED_VARS QWT_INCLUDE_DIR QWT_LIBRARY)
74