blob: 3969a89314525eb052a65846973fb1160756b7fc (
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
|
# Tell find_package(Qt5) where to find Qt.
if(QT_QMAKE_EXECUTABLE)
get_filename_component(Qt_BIN_DIR "${QT_QMAKE_EXECUTABLE}" PATH)
get_filename_component(Qt_PREFIX_DIR "${Qt_BIN_DIR}" PATH)
list(APPEND CMAKE_PREFIX_PATH ${Qt_PREFIX_DIR})
endif()
if (QT_TEST_VERSION EQUAL 4)
find_package(Qt4 REQUIRED)
include(UseQt4)
set(QT_QTCORE_TARGET Qt4::QtCore)
set(QT_QTGUI_TARGET Qt4::QtGui)
# Qt macros
macro(qtx_wrap_cpp)
qt4_wrap_cpp(${ARGN})
endmacro()
macro(qtx_generate_moc)
qt4_generate_moc(${ARGN})
endmacro()
elseif(QT_TEST_VERSION EQUAL 5)
find_package(Qt5Widgets REQUIRED)
set(QT_QTCORE_TARGET Qt5::Core)
set(QT_QTGUI_TARGET Qt5::Widgets)
include_directories(${Qt5Widgets_INCLUDE_DIRS})
set(QT_LIBRARIES Qt5::Widgets)
if(Qt5_POSITION_INDEPENDENT_CODE AND CMAKE_CXX_COMPILE_OPTIONS_PIC)
add_definitions(${CMAKE_CXX_COMPILE_OPTIONS_PIC})
endif()
# Qt macros
macro(qtx_wrap_cpp)
qt5_wrap_cpp(${ARGN})
endmacro()
macro(qtx_generate_moc)
qt5_generate_moc(${ARGN})
endmacro()
else()
message(SEND_ERROR "Invalid Qt version specified: ${QT_TEST_VERSION}")
endif()
# Get Qt compile features
get_property(QT_COMPILE_FEATURES
TARGET ${QT_QTCORE_TARGET}
PROPERTY INTERFACE_COMPILE_FEATURES
)
|