You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
56 lines
1.2 KiB
56 lines
1.2 KiB
7 years ago
|
|
||
|
# 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()
|
||
|
|
||
6 years ago
|
if (QT_TEST_VERSION EQUAL 4)
|
||
5 years ago
|
|
||
|
find_package(Qt4 REQUIRED QtCore)
|
||
7 years ago
|
include(UseQt4)
|
||
|
|
||
|
set(QT_QTCORE_TARGET Qt4::QtCore)
|
||
|
|
||
|
# Qt macros
|
||
|
macro(qtx_wrap_cpp)
|
||
|
qt4_wrap_cpp(${ARGN})
|
||
|
endmacro()
|
||
|
macro(qtx_generate_moc)
|
||
|
qt4_generate_moc(${ARGN})
|
||
|
endmacro()
|
||
|
|
||
6 years ago
|
elseif(QT_TEST_VERSION EQUAL 5)
|
||
5 years ago
|
|
||
|
find_package(Qt5Core REQUIRED)
|
||
7 years ago
|
|
||
|
set(QT_QTCORE_TARGET Qt5::Core)
|
||
5 years ago
|
set(QT_LIBRARIES Qt5::Core)
|
||
7 years ago
|
|
||
5 years ago
|
# Include directories
|
||
|
include_directories(${Qt5Core_INCLUDE_DIRS})
|
||
7 years ago
|
|
||
5 years ago
|
# Definitions
|
||
7 years ago
|
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
|
||
|
)
|