|
| 1 | +# |
| 2 | +# Surcouche CEA/DAM : ajout des targets (en fin de fichier) |
| 3 | +# |
| 4 | + |
| 5 | +# |
| 6 | +# (C) 2005-2017 Centre National d'Etudes Spatiales (CNES) |
| 7 | +# |
| 8 | +# This file is part of Orfeo Toolbox |
| 9 | +# |
| 10 | +# https://www.orfeo-toolbox.org/ |
| 11 | +# |
| 12 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 13 | +# you may not use this file except in compliance with the License. |
| 14 | +# You may obtain a copy of the License at |
| 15 | +# |
| 16 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 17 | +# |
| 18 | +# Unless required by applicable law or agreed to in writing, software |
| 19 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 20 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 21 | +# See the License for the specific language governing permissions and |
| 22 | +# limitations under the License. |
| 23 | +# |
| 24 | + |
| 25 | +# Qt Widgets for Technical Applications |
| 26 | +# available at http://www.http://qwt.sourceforge.net/ |
| 27 | +# |
| 28 | +# The module defines the following variables: |
| 29 | +# QWT_FOUND - the system has Qwt |
| 30 | +# QWT_INCLUDE_DIR - where to find qwt_plot.h |
| 31 | +# QWT_INCLUDE_DIRS - qwt includes |
| 32 | +# QWT_LIBRARY - where to find the Qwt library |
| 33 | +# QWT_LIBRARIES - additional libraries |
| 34 | +# QWT_MAJOR_VERSION - major version |
| 35 | +# QWT_MINOR_VERSION - minor version |
| 36 | +# QWT_PATCH_VERSION - patch version |
| 37 | +# QWT_VERSION_STRING - version (ex. 5.2.1) |
| 38 | +# QWT_ROOT_DIR - root dir |
| 39 | + |
| 40 | +#============================================================================= |
| 41 | +# Copyright 2010-2013, Julien Schueller |
| 42 | +# All rights reserved. |
| 43 | +# |
| 44 | +# Redistribution and use in source and binary forms, with or without |
| 45 | +# modification, are permitted provided that the following conditions are met: |
| 46 | +# |
| 47 | +# 1. Redistributions of source code must retain the above copyright notice, this |
| 48 | +# list of conditions and the following disclaimer. |
| 49 | +# 2. Redistributions in binary form must reproduce the above copyright notice, |
| 50 | +# this list of conditions and the following disclaimer in the documentation |
| 51 | +# and/or other materials provided with the distribution. |
| 52 | +# |
| 53 | +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
| 54 | +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
| 55 | +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| 56 | +# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR |
| 57 | +# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
| 58 | +# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
| 59 | +# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
| 60 | +# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 61 | +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
| 62 | +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 63 | + |
| 64 | +# The views and conclusions contained in the software and documentation are those |
| 65 | +# of the authors and should not be interpreted as representing official policies, |
| 66 | +# either expressed or implied, of the FreeBSD Project. |
| 67 | +#============================================================================= |
| 68 | + |
| 69 | +# message( "QWT_INCLUDE_DIR: '${QWT_INCLUDE_DIR}'" ) |
| 70 | +# message( "QWT_INCLUDE_DIR: '${QT_INCLUDE_DIR}'" ) |
| 71 | + |
| 72 | +find_path( QWT_INCLUDE_DIR |
| 73 | + NAMES qwt_plot.h |
| 74 | + PATH_SUFFIXES qwt |
| 75 | +) |
| 76 | + |
| 77 | +# message( "QWT_INCLUDE_DIR: '${QWT_INCLUDE_DIR}'" ) |
| 78 | +# message( "QWT_INCLUDE_DIR: '${QT_INCLUDE_DIR}'" ) |
| 79 | + |
| 80 | +set ( QWT_INCLUDE_DIRS ${QWT_INCLUDE_DIR} ) |
| 81 | + |
| 82 | +# version |
| 83 | +set ( _VERSION_FILE ${QWT_INCLUDE_DIR}/qwt_global.h ) |
| 84 | +if ( EXISTS ${_VERSION_FILE} ) |
| 85 | + file ( STRINGS ${_VERSION_FILE} _VERSION_LINE REGEX "define[ ]+QWT_VERSION_STR" ) |
| 86 | + if ( _VERSION_LINE ) |
| 87 | + string ( REGEX REPLACE ".*define[ ]+QWT_VERSION_STR[ ]+\"(.*)\".*" "\\1" QWT_VERSION_STRING "${_VERSION_LINE}" ) |
| 88 | + string ( REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+)" "\\1" QWT_MAJOR_VERSION "${QWT_VERSION_STRING}" ) |
| 89 | + string ( REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+)" "\\2" QWT_MINOR_VERSION "${QWT_VERSION_STRING}" ) |
| 90 | + string ( REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+)" "\\3" QWT_PATCH_VERSION "${QWT_VERSION_STRING}" ) |
| 91 | + endif () |
| 92 | +endif () |
| 93 | + |
| 94 | + |
| 95 | +# check version |
| 96 | +set ( _QWT_VERSION_MATCH TRUE ) |
| 97 | +if ( Qwt_FIND_VERSION AND QWT_VERSION_STRING ) |
| 98 | + if ( Qwt_FIND_VERSION_EXACT ) |
| 99 | + if ( NOT Qwt_FIND_VERSION VERSION_EQUAL QWT_VERSION_STRING ) |
| 100 | + set ( _QWT_VERSION_MATCH FALSE ) |
| 101 | + endif () |
| 102 | + else () |
| 103 | + if ( QWT_VERSION_STRING VERSION_LESS Qwt_FIND_VERSION ) |
| 104 | + set ( _QWT_VERSION_MATCH FALSE ) |
| 105 | + endif () |
| 106 | + endif () |
| 107 | +endif () |
| 108 | + |
| 109 | + |
| 110 | +find_library ( QWT_LIBRARY |
| 111 | + NAMES qwt qwt${QWT_MAJOR_VERSION} qwt-qt5 |
| 112 | + HINTS ${QT_LIBRARY_DIR} |
| 113 | +) |
| 114 | + |
| 115 | +set ( QWT_LIBRARIES ${QWT_LIBRARY} ) |
| 116 | + |
| 117 | +# try to guess root dir from include dir |
| 118 | +if ( QWT_INCLUDE_DIR ) |
| 119 | + string ( REGEX REPLACE "(.*)/include.*" "\\1" QWT_ROOT_DIR ${QWT_INCLUDE_DIR} ) |
| 120 | +# try to guess root dir from library dir |
| 121 | +elseif ( QWT_LIBRARY ) |
| 122 | + string ( REGEX REPLACE "(.*)/lib[/|32|64].*" "\\1" QWT_ROOT_DIR ${QWT_LIBRARY} ) |
| 123 | +endif () |
| 124 | + |
| 125 | +# handle the QUIETLY and REQUIRED arguments |
| 126 | +include ( FindPackageHandleStandardArgs ) |
| 127 | +if ( CMAKE_VERSION LESS 2.8.3 ) |
| 128 | + find_package_handle_standard_args( Qwt DEFAULT_MSG QWT_LIBRARY QWT_INCLUDE_DIR _QWT_VERSION_MATCH ) |
| 129 | +else () |
| 130 | + find_package_handle_standard_args( Qwt REQUIRED_VARS QWT_LIBRARY QWT_INCLUDE_DIR _QWT_VERSION_MATCH VERSION_VAR QWT_VERSION_STRING ) |
| 131 | +endif () |
| 132 | + |
| 133 | +mark_as_advanced ( |
| 134 | + QWT_LIBRARY |
| 135 | + QWT_LIBRARIES |
| 136 | + QWT_INCLUDE_DIR |
| 137 | + QWT_INCLUDE_DIRS |
| 138 | + QWT_MAJOR_VERSION |
| 139 | + QWT_MINOR_VERSION |
| 140 | + QWT_PATCH_VERSION |
| 141 | + QWT_VERSION_STRING |
| 142 | + QWT_ROOT_DIR |
| 143 | +) |
| 144 | + |
| 145 | +# ======================================================================================================================================= |
| 146 | +# CEA (ajout de la cible qwt pour le "cmake modern") : |
| 147 | +set (QWT_TARGET "qwt::qwt") |
| 148 | + |
| 149 | +add_library (${QWT_TARGET} SHARED IMPORTED) |
| 150 | +set_target_properties (qwt::qwt PROPERTIES |
| 151 | + INTERFACE_INCLUDE_DIRECTORIES ${QWT_INCLUDE_DIR} |
| 152 | + IMPORTED_LOCATION ${QWT_LIBRARIES} |
| 153 | +# INTERFACE_LINK_LIBRARIES ${QWT_LIBRARIES} # A priori on y met plutôt les dépendances, par exemple les libs Qt*. |
| 154 | + ) |
| 155 | +# Fin CEA |
| 156 | +# ======================================================================================================================================= |
0 commit comments