Mercurial > hg > orthanc-stone
comparison Resources/CMake/QtConfiguration.cmake @ 1040:14c0a29cd9ec
qt and lsb
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 08 Oct 2019 11:19:58 +0200 |
parents | 4e713ef78a5a |
children | 95939fa925f6 |
comparison
equal
deleted
inserted
replaced
1039:3a35d8397559 | 1040:14c0a29cd9ec |
---|---|
18 | 18 |
19 | 19 |
20 set(CMAKE_AUTOMOC OFF) | 20 set(CMAKE_AUTOMOC OFF) |
21 set(CMAKE_AUTOUIC OFF) | 21 set(CMAKE_AUTOUIC OFF) |
22 | 22 |
23 # Find the QtWidgets library | 23 if ("${CMAKE_SYSTEM_VERSION}" STREQUAL "LinuxStandardBase") |
24 find_package(Qt5Widgets QUIET) | 24 # Linux Standard Base version 5 ships Qt 4.2.3 |
25 include(Qt4Macros) | |
25 | 26 |
26 if (Qt5Widgets_FOUND) | 27 set(QT_UIC_EXECUTABLE ${LSB_PATH}/bin/uic) |
27 message("Qt5 has been detected") | 28 set(QT_MOC_EXECUTABLE ${LSB_PATH}/bin/moc) |
28 find_package(Qt5Core REQUIRED) | 29 |
29 link_libraries( | 30 include_directories( |
30 Qt5::Widgets | 31 ${LSB_PATH}/include/QtCore |
31 Qt5::Core | 32 ${LSB_PATH}/include/QtGui |
33 ${LSB_PATH}/include/QtOpenGL | |
32 ) | 34 ) |
33 | 35 |
34 if (ENABLE_OPENGL) | |
35 link_libraries( | |
36 Qt5::QtOpenGL | |
37 ) | |
38 endif() | |
39 | |
40 # Create aliases for the CMake commands | |
41 macro(ORTHANC_QT_WRAP_UI) | |
42 QT5_WRAP_UI(${ARGN}) | |
43 endmacro() | |
44 | |
45 macro(ORTHANC_QT_WRAP_CPP) | |
46 QT5_WRAP_CPP(${ARGN}) | |
47 endmacro() | |
48 | |
49 else() | |
50 message("Qt5 has not been found, trying with Qt4") | |
51 find_package(Qt4 REQUIRED QtGui) | |
52 link_libraries( | |
53 Qt4::QtGui | |
54 ) | |
55 | |
56 if (ENABLE_OPENGL) | |
57 link_libraries( | |
58 Qt4::QtOpenGL | |
59 ) | |
60 endif() | |
61 | |
62 # Create aliases for the CMake commands | |
63 macro(ORTHANC_QT_WRAP_UI) | 36 macro(ORTHANC_QT_WRAP_UI) |
64 QT4_WRAP_UI(${ARGN}) | 37 QT4_WRAP_UI(${ARGN}) |
65 endmacro() | 38 endmacro() |
66 | 39 |
67 macro(ORTHANC_QT_WRAP_CPP) | 40 macro(ORTHANC_QT_WRAP_CPP) |
68 QT4_WRAP_CPP(${ARGN}) | 41 QT4_WRAP_CPP(${ARGN}) |
69 endmacro() | 42 endmacro() |
43 | |
44 link_libraries(QtCore QtGui QtOpenGL) | |
70 | 45 |
46 else() | |
47 # Not using Linux Standard Base | |
48 # Find the QtWidgets library | |
49 find_package(Qt5Widgets QUIET) | |
50 | |
51 if (Qt5Widgets_FOUND) | |
52 message("Qt5 has been detected") | |
53 find_package(Qt5Core REQUIRED) | |
54 link_libraries( | |
55 Qt5::Widgets | |
56 Qt5::Core | |
57 ) | |
58 | |
59 if (ENABLE_OPENGL) | |
60 find_package(Qt5OpenGL REQUIRED) | |
61 link_libraries( | |
62 Qt5::OpenGL | |
63 ) | |
64 endif() | |
65 | |
66 # Create aliases for the CMake commands | |
67 macro(ORTHANC_QT_WRAP_UI) | |
68 QT5_WRAP_UI(${ARGN}) | |
69 endmacro() | |
70 | |
71 macro(ORTHANC_QT_WRAP_CPP) | |
72 QT5_WRAP_CPP(${ARGN}) | |
73 endmacro() | |
74 | |
75 else() | |
76 message("Qt5 has not been found, trying with Qt4") | |
77 find_package(Qt4 REQUIRED QtGui) | |
78 link_libraries( | |
79 Qt4::QtGui | |
80 ) | |
81 | |
82 if (ENABLE_OPENGL) | |
83 find_package(Qt4 REQUIRED QtOpenGL) | |
84 link_libraries( | |
85 Qt4::QtOpenGL | |
86 ) | |
87 endif() | |
88 | |
89 # Create aliases for the CMake commands | |
90 macro(ORTHANC_QT_WRAP_UI) | |
91 QT4_WRAP_UI(${ARGN}) | |
92 endmacro() | |
93 | |
94 macro(ORTHANC_QT_WRAP_CPP) | |
95 QT4_WRAP_CPP(${ARGN}) | |
96 endmacro() | |
97 endif() | |
71 endif() | 98 endif() |
72 | 99 |
73 | 100 |
74 list(APPEND QT_SOURCES | |
75 ${ORTHANC_STONE_ROOT}/Applications/Qt/QCairoWidget.cpp | |
76 ) | |
77 | |
78 ORTHANC_QT_WRAP_CPP(QT_SOURCES | |
79 ${ORTHANC_STONE_ROOT}/Applications/Qt/QCairoWidget.h | |
80 ) | |
81 | |
82 if (ENABLE_STONE_DEPRECATED) | 101 if (ENABLE_STONE_DEPRECATED) |
83 list(APPEND QT_SOURCES | 102 list(APPEND QT_SOURCES |
103 ${ORTHANC_STONE_ROOT}/Applications/Qt/QCairoWidget.cpp | |
104 ${ORTHANC_STONE_ROOT}/Applications/Qt/QStoneMainWindow.cpp | |
84 ${ORTHANC_STONE_ROOT}/Applications/Qt/QtStoneApplicationRunner.cpp | 105 ${ORTHANC_STONE_ROOT}/Applications/Qt/QtStoneApplicationRunner.cpp |
85 ${ORTHANC_STONE_ROOT}/Applications/Qt/QStoneMainWindow.cpp | |
86 ) | 106 ) |
87 | 107 |
88 ORTHANC_QT_WRAP_CPP(QT_SOURCES | 108 ORTHANC_QT_WRAP_CPP(QT_SOURCES |
109 ${ORTHANC_STONE_ROOT}/Applications/Qt/QCairoWidget.h | |
89 ${ORTHANC_STONE_ROOT}/Applications/Qt/QStoneMainWindow.h | 110 ${ORTHANC_STONE_ROOT}/Applications/Qt/QStoneMainWindow.h |
90 ) | 111 ) |
91 endif() | 112 endif() |
92 | 113 |
93 | 114 |