forked from lxqt/compton-conf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
119 lines (97 loc) · 2.89 KB
/
CMakeLists.txt
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
project(compton-conf)
cmake_minimum_required(VERSION 2.8.12)
set(LXQTBT_MINIMUM_VERSION "0.1.0")
option(UPDATE_TRANSLATIONS "Update source translation translations/*.ts files" OFF)
find_package(lxqt-build-tools ${LXQTBT_MINIMUM_VERSION} REQUIRED)
include(LXQtTranslateTs)
include(LXQtTranslateDesktop)
# Support Qt4
option(USE_QT4 "Build with Qt4." $ENV{USE_QT4})
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_AUTOMOC ON)
if(USE_QT4)
find_package(Qt4 REQUIRED QtCore QtGui QtDbus)
include(${QT_USE_FILE})
message(STATUS "Building with Qt${QTVERSION}")
else()
cmake_minimum_required(VERSION 2.8.11)
find_package(Qt5Widgets REQUIRED)
find_package(Qt5DBus REQUIRED)
find_package(Qt5LinguistTools REQUIRED QUIET)
message(STATUS "Building with Qt${Qt5Core_VERSION_STRING}")
endif()
# libconfig using pkg-config
find_package(PkgConfig REQUIRED)
pkg_check_modules(LIBCONFIG REQUIRED
libconfig
)
include(GNUInstallDirs REQUIRED)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DQT_NO_KEYWORDS -fno-exceptions")
if(USE_QT4)
set(QTX_INCLUDE_DIRS ${QT_QTCORE_INCLUDE_DIR} ${QT_QTGUI_INCLUDE_DIR} ${QT_QTDBUS_DIR})
set(QTX_LIBRARIES ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${QT_QTDBUS_LIBRARY})
else()
set(QTX_INCLUDE_DIRS "")
set(QTX_LIBRARIES Qt5::Widgets Qt5::DBus)
endif()
include_directories(
${QTX_INCLUDE_DIRS}
${LIBCONFIG_INCLUDE_DIRS}
${CMAKE_CURRENT_BINARY_DIR}
)
set(compton-conf_HS
compton-conf.h
maindialog.h
)
set(compton-conf_SRCS
maindialog.cpp
compton-conf.cpp
)
set(compton-conf_UIS
maindialog.ui
)
set(compton-conf_DESKTOP_FILES_IN
compton-conf.desktop.in
)
lxqt_translate_ts(compton-conf_QM_FILES
USE_QT4 ${USE_QT4}
UPDATE_TRANSLATIONS ${UPDATE_TRANSLATIONS}
SOURCES
${compton-conf_HS}
${compton-conf_SRCS}
${compton-conf_UIS}
INSTALL_DIR
${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/translations
PULL_TRANSLATIONS
${PULL_TRANSLATIONS}
CLEAN_TRANSLATIONS
${CLEAN_TRANSLATIONS}
TRANSLATIONS_REPO
${TRANSLATIONS_REPO}
TRANSLATIONS_REFSPEC
${TRANSLATIONS_REFSPEC}
)
lxqt_translate_desktop(compton-conf_DESKTOP_FILES SOURCES ${compton-conf_DESKTOP_FILES_IN})
if(USE_QT4)
qt4_wrap_ui(compton-conf_UI_H ${compton-conf_UIS})
else()
qt5_wrap_ui(compton-conf_UI_H ${compton-conf_UIS})
endif()
add_definitions(
-DCOMPTON_CONF_DATA_DIR="${CMAKE_INSTALL_FULL_DATADIR}/compton-conf"
)
add_executable(compton-conf
${compton-conf_SRCS}
${compton-conf_UI_H}
${compton-conf_QM_FILES}
${compton-conf_QM_LOADER}
${compton-conf_DESKTOP_FILES}
)
target_link_libraries(compton-conf
${QTX_LIBRARIES}
${LIBCONFIG_LIBRARIES}
)
install(TARGETS compton-conf RUNTIME DESTINATION bin)
install(FILES compton.conf.example DESTINATION ${CMAKE_INSTALL_DATADIR}/compton-conf)
install(FILES ${compton-conf_DESKTOP_FILES} DESTINATION ${CMAKE_INSTALL_DATADIR}/applications/)