comparison Resources/CMake/QtConfiguration.cmake @ 1043:b26fb3a99f01

merge
author Alain Mazy <alain@mazy.be>
date Wed, 09 Oct 2019 15:35:01 +0200
parents 95939fa925f6
children b60d70e8b55c
comparison
equal deleted inserted replaced
1042:08cdcadfab14 1043:b26fb3a99f01
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 # The script "LinuxStandardBaseUic.py" is just a wrapper around the
27 message("Qt5 has been detected") 28 # "uic" compiler from LSB that does not support the "<?xml ...?>"
28 find_package(Qt5Core REQUIRED) 29 # header that is automatically added by Qt Creator
29 link_libraries( 30 set(QT_UIC_EXECUTABLE ${CMAKE_CURRENT_LIST_DIR}/LinuxStandardBaseUic.py)
30 Qt5::Widgets 31
31 Qt5::Core 32 set(QT_MOC_EXECUTABLE ${LSB_PATH}/bin/moc)
33
34 include_directories(
35 ${LSB_PATH}/include/QtCore
36 ${LSB_PATH}/include/QtGui
37 ${LSB_PATH}/include/QtOpenGL
32 ) 38 )
33 39
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) 40 macro(ORTHANC_QT_WRAP_UI)
64 QT4_WRAP_UI(${ARGN}) 41 QT4_WRAP_UI(${ARGN})
65 endmacro() 42 endmacro()
66 43
67 macro(ORTHANC_QT_WRAP_CPP) 44 macro(ORTHANC_QT_WRAP_CPP)
68 QT4_WRAP_CPP(${ARGN}) 45 QT4_WRAP_CPP(${ARGN})
69 endmacro() 46 endmacro()
47
48 link_libraries(QtCore QtGui QtOpenGL)
70 49
50 else()
51 # Not using Linux Standard Base
52 # Find the QtWidgets library
53 find_package(Qt5Widgets QUIET)
54
55 if (Qt5Widgets_FOUND)
56 message("Qt5 has been detected")
57 find_package(Qt5Core REQUIRED)
58 link_libraries(
59 Qt5::Widgets
60 Qt5::Core
61 )
62
63 if (ENABLE_OPENGL)
64 find_package(Qt5OpenGL REQUIRED)
65 link_libraries(
66 Qt5::OpenGL
67 )
68 endif()
69
70 # Create aliases for the CMake commands
71 macro(ORTHANC_QT_WRAP_UI)
72 QT5_WRAP_UI(${ARGN})
73 endmacro()
74
75 macro(ORTHANC_QT_WRAP_CPP)
76 QT5_WRAP_CPP(${ARGN})
77 endmacro()
78
79 else()
80 message("Qt5 has not been found, trying with Qt4")
81 find_package(Qt4 REQUIRED QtGui)
82 link_libraries(
83 Qt4::QtGui
84 )
85
86 if (ENABLE_OPENGL)
87 find_package(Qt4 REQUIRED QtOpenGL)
88 link_libraries(
89 Qt4::QtOpenGL
90 )
91 endif()
92
93 # Create aliases for the CMake commands
94 macro(ORTHANC_QT_WRAP_UI)
95 QT4_WRAP_UI(${ARGN})
96 endmacro()
97
98 macro(ORTHANC_QT_WRAP_CPP)
99 QT4_WRAP_CPP(${ARGN})
100 endmacro()
101 endif()
71 endif() 102 endif()
72 103
73 104
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) 105 if (ENABLE_STONE_DEPRECATED)
83 list(APPEND QT_SOURCES 106 list(APPEND QT_SOURCES
107 ${ORTHANC_STONE_ROOT}/Applications/Qt/QCairoWidget.cpp
108 ${ORTHANC_STONE_ROOT}/Applications/Qt/QStoneMainWindow.cpp
84 ${ORTHANC_STONE_ROOT}/Applications/Qt/QtStoneApplicationRunner.cpp 109 ${ORTHANC_STONE_ROOT}/Applications/Qt/QtStoneApplicationRunner.cpp
85 ${ORTHANC_STONE_ROOT}/Applications/Qt/QStoneMainWindow.cpp
86 ) 110 )
87 111
88 ORTHANC_QT_WRAP_CPP(QT_SOURCES 112 ORTHANC_QT_WRAP_CPP(QT_SOURCES
113 ${ORTHANC_STONE_ROOT}/Applications/Qt/QCairoWidget.h
89 ${ORTHANC_STONE_ROOT}/Applications/Qt/QStoneMainWindow.h 114 ${ORTHANC_STONE_ROOT}/Applications/Qt/QStoneMainWindow.h
90 ) 115 )
91 endif() 116 endif()
92 117
93 118