-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
87 lines (82 loc) · 3.61 KB
/
Copy pathCMakeLists.txt
File metadata and controls
87 lines (82 loc) · 3.61 KB
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
cmake_minimum_required(VERSION 3.10.0)
project(k4oxygen CXX)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_AUTOMOC ON)
if(NOT DEFINED QT_VERSION)
message("** NOTE: QT_VERSION is not defined, using default setup: Qt4. Pass -DQT_VERSION=5 to cmake to\n choose Qt5, -DQT_VERSION=6 to cmake to choose Qt6, or -DQT_VERSION=4 to get rid of this\n message and choose Qt4.")
set(QT_VERSION 4)
endif()
if("${QT_VERSION}" STREQUAL 6)
message("++ Compiling style for Qt 6")
find_package(Qt6 6.0 REQUIRED Core DBus Gui Widgets)
set(QT_LIBRARIES Qt6::Core Qt6::DBus Qt6::Gui Qt6::Widgets)
find_package(X11 QUIET)
if(NOT DEFINED PLUGIN_INSTALL_DIR)
get_target_property(libQtCorePath Qt6::Core LOCATION)
get_filename_component(libQtCoreDir "${libQtCorePath}" DIRECTORY)
set(QMakeExecutable "${libQtCoreDir}/../bin/qmake6")
if(NOT EXISTS "${QMakeExecutable}")
set(QMakeExecutable "${libQtCoreDir}/../../bin/qmake6")
if(NOT EXISTS "${QMakeExecutable}")
message(WARNING "Failed to find qmake6 executable, style installation directory will be wrong")
endif()
endif()
execute_process(COMMAND "${QMakeExecutable}" -query QT_INSTALL_PLUGINS
OUTPUT_VARIABLE Qt6PluginInstallDir
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE)
set(PLUGIN_INSTALL_DIR "${Qt6PluginInstallDir}/styles/")
endif()
elseif("${QT_VERSION}" STREQUAL 5)
message("++ Compiling style for Qt 5")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
find_package(Qt5 5.5 COMPONENTS Core X11Extras QUIET)
find_package(Qt5 5.5 REQUIRED Core DBus Gui Widgets)
set(QT_LIBRARIES Qt5::Core Qt5::DBus Qt5::Gui Qt5::Widgets)
if(Qt5X11Extras_FOUND)
list(APPEND QT_LIBRARIES Qt5::X11Extras)
set(X11_FOUND TRUE)
else()
if(UNIX AND NOT APPLE)
message(WARNING "QtX11Extras package wasn't found. Shadows and smooth corners of menus and tooltips, as well as dragging by empty areas, won't be supported.")
endif()
endif()
if(NOT DEFINED PLUGIN_INSTALL_DIR)
find_package(Qt5Core)
get_target_property(QMakeExecutable ${Qt5Core_QMAKE_EXECUTABLE} IMPORTED_LOCATION)
execute_process(COMMAND "${QMakeExecutable}" -query QT_INSTALL_PLUGINS
OUTPUT_VARIABLE Qt5PluginInstallDir
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE)
set(PLUGIN_INSTALL_DIR "${Qt5PluginInstallDir}/styles/")
endif()
elseif("${QT_VERSION}" STREQUAL 4)
message("++ Compiling style for Qt 4")
find_package(Qt4 4.8 REQUIRED QtCore QtDBus QtGui)
include(${QT_USE_FILE})
find_path(QX11Info_PATH QX11Info PATHS ${QT_INCLUDES} NO_DEFAULT_PATH)
if(QX11Info_PATH)
set(X11_FOUND TRUE)
endif()
if(NOT DEFINED PLUGIN_INSTALL_DIR)
set(PLUGIN_INSTALL_DIR "${QT_PLUGINS_DIR}/styles/")
endif()
else()
message(FATAL_ERROR "QT_VERSION must be one of 4, 5, 6")
endif()
if(X11_FOUND)
add_definitions(-DHAVE_X11=1)
# XLib found, but we also need XCB
find_package(PkgConfig REQUIRED)
pkg_check_modules(XCB_PACKAGE x11-xcb REQUIRED)
link_directories(${XCB_PACKAGE_LIBRARY_DIRS})
include_directories(${XCB_PACKAGE_INCLUDE_DIRS})
set(X11_LIBRARIES ${X11_LIBRARIES} ${XCB_PACKAGE_LIBRARIES})
endif()
message("++ Will install Qt plugin to ${PLUGIN_INSTALL_DIR}")
set(GENERIC_LIB_VERSION 0.0.1)
set(GENERIC_LIB_SOVERSION 0)
add_definitions (${QT_DEFINITIONS})
include_directories (${QT_INCLUDES})
add_subdirectory(style)