summaryrefslogtreecommitdiffstats
path: root/Modules/FindQt.cmake
blob: a19fc9fa6e197f1f31bb9e3148552c41b8827359 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# Locate Qt include paths and libraries

# This module defines
# QT_INCLUDE_DIR, where to find qt.h, etc.
# QT_LIBRARIES, the libraries to link against to use Qt.
# QT_DEFINITIONS, definitions to use when compiling code that uses Qt.
# QT_WRAP_CPP, If false, don't use QT_WRAP_CPP command.
# QT_WRAP_UI, If false, don't use QT_WRAP_UI command.
# QT_FOUND, If false, do try to use Qt.

# also defined, but not for general use are
# QT_MOC_EXECUTABLE, where to find the moc tool.
# QT_UIC_EXECUTABLE, where to find the uic tool.
# QT_QT_LIBRARY, where to find the Qt library.
# QT_QTMAIN_LIBRARY, where to find the qtmain library. This is only required by Qt3 on Windows.

IF (UNIX)

  FIND_PATH(QT_INCLUDE_DIR qt.h
    ${QTDIR}/include
    /usr/local/qt/include
    /usr/local/include
    /usr/include
  )

  FIND_LIBRARY(QT_QT_LIBRARY qt
    ${QTDIR}/lib
    /usr/local/qt/lib
    /usr/local/lib
    /usr/lib
  )

  FIND_FILE(QT_MOC_EXECUTABLE moc
    ${QTDIR}/bin
    ${path}
  )

  FIND_FILE(QT_UIC_EXECUTABLE uic
    ${QTDIR}/bin
    ${path}
  )

ENDIF (UNIX)

IF (WIN32)
  # Not sure where to look for Qt under windows
  # Assume that QTDIR has been set

  FIND_PATH(QT_INCLUDE_DIR qt.h
    ${QTDIR}/include C:/Progra~1/qt/include) )

  FIND_LIBRARY(QT_QT_LIBRARY qt
    ${QTDIR}/lib C:/Progra~1/qt/lib )

  FIND_LIBRARY(QT_QTMAIN_LIBRARY qtmain
    ${QTDIR}/lib C:/Progra~1/qt/lib
    DOC "This Library is only needed by and included with Qt3 on MSWindows. It should be NOTFOUND, undefined or IGNORE otherwise."
  )

  FIND_FILE(QT_MOC_EXECUTABLE moc.exe
    ${QTDIR}/bin C:/Progra~1/qt/bin
    ${path} )

  FIND_FILE(QT_UIC_EXECUTABLE uic.exe
    ${QTDIR}/bin C:/Progra~1/qt/bin
    ${path} )

ENDIF (WIN32)


IF (QT_MOC_EXECUTABLE)
  SET ( QT_WRAP_CPP "YES")
ENDIF (QT_MOC_EXECUTABLE)

IF (QT_UIC_EXECUTABLE)
  SET ( QT_WRAP_UI "YES")
ENDIF (QT_UIC_EXECUTABLE)


IF(QT_INCLUDE_DIR)
  IF(QT_QT_LIBRARY)
    SET( QT_LIBRARIES ${QT_LIBRARIES} ${QT_QT_LIBRARY} )
    SET( QT_FOUND "YES" )
    SET( QT_DEFINITIONS "")

    IF (WIN32)
      IF (QT_QTMAIN_LIBRARY)
        # for version 3
        SET (QT_DEFINITIONS -DQT_DLL)
        SET (QT_LIBRARIES imm32.lib  ${QT_QT_LIBRARY} ${QT_QTMAIN_LIBRARY} )
      ELSE (QT_QTMAIN_LIBRARY)
        # for version 2
        SET (QT_LIBRARIES imm32.lib ws2_32.lib  ${QT_QT_LIBRARY} )
      ENDIF (QT_QTMAIN_LIBRARY)
    ELSE (WIN32)
      SET (QT_LIBRARIES ${QT_QT_LIBRARY} )
    ENDIF (WIN32)

# Backwards compatibility for CMake1.4 and 1.2
    SET (QT_MOC_EXE ${QT_MOC_EXECUTABLE} )
    SET (QT_UIC_EXE ${QT_UIC_EXECUTABLE} )

  ENDIF(QT_QT_LIBRARY)
ENDIF(QT_INCLUDE_DIR)