FindQwt6.cmake 5.24 KB
Newer Older
1
2
3
4
5
# - Try to find Qwt6
# Once done this will define
#  QWT6_FOUND - System has Qwt6
#  QWT6_INCLUDE_DIRS - The Qwt6 include directories
#  QWT6_LIBRARIES - The libraries needed to use Qwt6
Jan Möbius's avatar
Jan Möbius committed
6
#  QWT6_DEFINITIONS - Compiler switches required for using Qwt6
7

8
9


10
11
12
# Check if the base path is set
if ( NOT CMAKE_WINDOWS_LIBS_DIR )
  # This is the base directory for windows library search used in the finders we shipp.
Jan Möbius's avatar
Jan Möbius committed
13
  set(CMAKE_WINDOWS_LIBS_DIR "c:/libs" CACHE STRING "Default Library search dir on windows." )
Jan Möbius's avatar
Jan Möbius committed
14
endif()
15

16
if ( CMAKE_GENERATOR MATCHES "^Visual Studio 11.*Win64" )
17
  SET(VS_SEARCH_PATH "${CMAKE_WINDOWS_LIBS_DIR}/vs2012/x64/")
18
elseif ( CMAKE_GENERATOR MATCHES "^Visual Studio 11.*" )
19
  SET(VS_SEARCH_PATH "${CMAKE_WINDOWS_LIBS_DIR}/vs2012/x32/")
20
elseif ( CMAKE_GENERATOR MATCHES "^Visual Studio 12.*Win64" )
21
  SET(VS_SEARCH_PATH "${CMAKE_WINDOWS_LIBS_DIR}/vs2013/x64/")
22
elseif ( CMAKE_GENERATOR MATCHES "^Visual Studio 12.*" )
23
24
25
26
27
  SET(VS_SEARCH_PATH "${CMAKE_WINDOWS_LIBS_DIR}/vs2013/x32/")
elseif ( CMAKE_GENERATOR MATCHES "^Visual Studio 14.*Win64" )
  SET(VS_SEARCH_PATH "${CMAKE_WINDOWS_LIBS_DIR}/vs2015/x64/")
elseif ( CMAKE_GENERATOR MATCHES "^Visual Studio 14.*" )
  SET(VS_SEARCH_PATH "${CMAKE_WINDOWS_LIBS_DIR}/vs2015/x32/")
28
29
endif()

Matthias Möller's avatar
Matthias Möller committed
30
if (QT5_FOUND)
31
    if (${Qt5Core_VERSION_STRING} VERSION_EQUAL "5.5.1" OR ${Qt5Core_VERSION_STRING} VERSION_GREATER "5.5.1")
Jan Möbius's avatar
Jan Möbius committed
32
        SET(ACG_SEARCH_PATH "/ACG/acgdev/gcc-4.9-x86_64/qwt-6.1.2-qt5.6")
33
34
35
    else()
        SET(ACG_SEARCH_PATH "/ACG/acgdev/gcc-4.9-x86_64/qwt-6.1-qt5")
    endif()
Matthias Möller's avatar
Matthias Möller committed
36
37
38
else()
    SET(ACG_SEARCH_PATH "/usr/local/qwt/")
endif()
Jan Möbius's avatar
Jan Möbius committed
39
40


41
42
find_path(QWT6_INCLUDE_DIR qwt.h
               PATHS ${QT_INCLUDE_DIR}
Matthias Möller's avatar
Matthias Möller committed
43
               "${ACG_SEARCH_PATH}/include"
44
45
46
47
48
               /usr/local/qwt/include
               /usr/local/include
               /opt/local/include
               /opt/local/include/qwt
               /usr/include
49
               /usr/include/qwt
Jan Möbius's avatar
Jan Möbius committed
50
               "${VS_SEARCH_PATH}/qwt-6.1.0/include"
51
52
53
54
55
56
57
58
59
               c:\\libs\\${SEARCHPATH}\\x32\\Qwt-6.1.0
               c:\\libs\\${SEARCHPATH}\\x32\\Qwt-6.0.2
               c:\\libs\\${SEARCHPATH}\\x32\\Qwt-6.0.1
               c:\\libs\\Qwt-6.1.0
               c:\\libs\\Qwt-6.0.2
               c:\\libs\\Qwt-6.0.1
               c:\\libs\\qwt-6.1.0
               c:\\libs\\qwt-6.0.2
               c:\\libs\\qwt-6.0.1
Matthias Möller's avatar
Matthias Möller committed
60
61
62
               #PATH_SUFFIXES qwt qwt6 qwt-6.1.0 qwt-6.0.2 qwt-6.0.1 include qwt/include qwt6/include #deactivated for acg dir
               ENV PATH
               )
63
64
65
66
67
68
69
70
71
72

if (EXISTS "${QWT6_INCLUDE_DIR}/qwt_global.h")
  file( READ ${QWT6_INCLUDE_DIR}/qwt_global.h QWT_GLOBAL_H )
  string( REGEX MATCH "#define *QWT_VERSION *(0x06*)" QWT6_VERSION_FOUND ${QWT_GLOBAL_H})
  if (NOT QWT6_VERSION_FOUND)
    message(WARNING "Qwt is not version 6")
  endif()
endif()

if (QWT6_VERSION_FOUND)
73
74
75
  if (WIN32)
    find_library(QWT6_LIBRARY_RELEASE NAMES qwt
      PATHS
76
      "${VS_SEARCH_PATH}/qwt-6.1.0/lib"
77
78
79
80
81
82
83
84
      "c:\\libs\\${SEARCHPATH}\\x32\\Qwt-6.0.2\\lib"
      "c:\\libs\\${SEARCHPATH}\\x32\\Qwt-6.1.0\\lib"
      "c:\\libs\\Qwt-6.1.0\\lib"
      "c:\\libs\\Qwt-6.0.2\\lib"
      "c:\\libs\\qwt-6.0.1\\lib"
      )
    find_library(QWT6_LIBRARY_DEBUG NAMES qwtd
      PATHS
85
      "${VS_SEARCH_PATH}/qwt-6.1.0/lib"
86
87
88
89
90
      "c:\\libs\\${SEARCHPATH}\\x32\\Qwt-6.0.2\\lib"
      "c:\\libs\\${SEARCHPATH}\\x32\\Qwt-6.1.0\\lib"
      "c:\\libs\\Qwt-6.1.0\\lib"
      "c:\\libs\\Qwt-6.0.2\\lib"
      "c:\\libs\\qwt-6.0.1\\lib"
91
92
93
94
95
96
97
98
99
100
101
102
103
104
  
    )

    #sets the library dirs
    if ( QWT6_LIBRARY_RELEASE )
      get_filename_component(_QWT6_LIBRARY_DIR_RELEASE ${QWT6_LIBRARY_RELEASE} PATH)
      set (QWT6_LIBRARY_DIR "${_QWT6_LIBRARY_DIR_RELEASE}" CACHE PATH "The directory where the QWT6 libraries can be found.")
    endif()

    #sets the library dirs
    if ( QWT6_LIBRARY_DEBUG )
      get_filename_component(_QWT6_LIBRARY_DIR_DEBUG ${QWT6_LIBRARY_DEBUG} PATH)
      set (QWT6_LIBRARY_DIR "${_QWT6_LIBRARY_DIR_DEBUG}" CACHE PATH "The directory where the QWT6 libraries can be found.")
    endif()                                                                                                                      
105
106
107
108
109
110
111
112

    set (
      QWT6_LIBRARY
      "optimized;${QWT6_LIBRARY_RELEASE};debug;${QWT6_LIBRARY_DEBUG}" CACHE
      STRING "QWT6 Libraries"
      )
# MACOS and LINUX
  else()
Matthias Möller's avatar
Matthias Möller committed
113
    find_library(QWT6_LIBRARY NAMES qwt-qt5
114
      PATHS
Matthias Möller's avatar
Matthias Möller committed
115
116
117
      "${ACG_SEARCH_PATH}/lib"
      NO_CMAKE_PATH
      NO_CMAKE_ENVIRONMENT_PATH
118
      )
Matthias Möller's avatar
Matthias Möller committed
119
120
121
122
123
124
125
126
127
128
  
    if (NOT QWT6_LIBRARY) # if not the specific acg qwt installation was found, try system wide
      find_library(QWT6_LIBRARY NAMES qwt
        PATHS
        /usr/local/qwt/lib
        /opt/local/lib
        /usr/local/lib
        /usr/lib
        )
    endif()
129

130
131
132
    #sets the library dir 
    get_filename_component(_QWT6_LIBRARY_DIR ${QWT6_LIBRARY} PATH)
    set (QWT6_LIBRARY_DIR "${_QWT6_LIBRARY_DIR}" CACHE PATH "The directory where the QWT6 libraries can be found.")
Jan Möbius's avatar
Jan Möbius committed
133

134
  endif()
Jan Möbius's avatar
Jan Möbius committed
135

Jan Möbius's avatar
Jan Möbius committed
136
  set(QWT6_LIBRARIES ${QWT6_LIBRARY} )
137
138
139
140
141
142
143
144
145
146
  set(QWT6_INCLUDE_DIRS ${QWT6_INCLUDE_DIR} )
endif()

include(FindPackageHandleStandardArgs)
# handle the QUIETLY and REQUIRED arguments and set LIBXML2_FOUND to TRUE
# if all listed variables are TRUE
find_package_handle_standard_args(QWT6  DEFAULT_MSG
                                  QWT6_LIBRARY QWT6_INCLUDE_DIR)

mark_as_advanced(QWT6_INCLUDE_DIR QWT6_LIBRARY)