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
|
project(dbusmenu-qt)
cmake_minimum_required(VERSION 2.6.0)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/modules")
# Build options
option(WITH_DOC "Build documentation (requires Doxygen)" ON)
# Versions
## Package version
set(dbusmenu_qt_VERSION_MAJOR 0)
set(dbusmenu_qt_VERSION_MINOR 9)
set(dbusmenu_qt_VERSION_PATCH 2)
set(dbusmenu_qt_VERSION ${dbusmenu_qt_VERSION_MAJOR}.${dbusmenu_qt_VERSION_MINOR}.${dbusmenu_qt_VERSION_PATCH})
## Lib version
### Bump this one when a binary-incompatible change is introduced
set(dbusmenu_qt_lib_SOVERSION 2)
### Bump this one when the API is extended in a binary-compatible way
set(dbusmenu_qt_lib_API_VERSION 6)
### Bump this one when changes do not extend the API
set(dbusmenu_qt_lib_PATCH_VERSION 0)
set(dbusmenu_qt_lib_VERSION ${dbusmenu_qt_lib_SOVERSION}.${dbusmenu_qt_lib_API_VERSION}.${dbusmenu_qt_lib_PATCH_VERSION})
# Check if we want to explicitly select the Qt version to be used or autodetect
if (NOT USE_QT4 AND NOT USE_QT5)
# Autodetect, prefering Qt5
message(STATUS "Autodetecting Qt version to use")
find_package(Qt5Widgets QUIET)
if (Qt5Widgets_FOUND)
set(USE_QT5 TRUE)
endif()
endif()
# Detect for which Qt version we're building
if (USE_QT5)
find_package(Qt5Widgets REQUIRED)
find_package(Qt5DBus REQUIRED)
include_directories(${Qt5Widgets_INCLUDE_DIRS} ${Qt5DBus_INCLUDE_DIRS})
find_package(Qt5Core REQUIRED)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOMOC_RELAXED_MODE ON)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(QT_SUFFIX "qt5")
else()
find_package(Qt4 REQUIRED)
include_directories(
${QT_INCLUDE_DIR}
${QT_QTCORE_INCLUDE_DIR}
${QT_QTDBUS_INCLUDE_DIR}
${QT_QTGUI_INCLUDE_DIR}
)
set(QT_SUFFIX "qt")
endif()
include(GNUInstallDirs)
set(LIB_DESTINATION "${CMAKE_INSTALL_LIBDIR}")
# dist targets
set(ARCHIVE_NAME libdbusmenu-${QT_SUFFIX}-${dbusmenu_qt_VERSION})
add_custom_target(dist
COMMAND bzr export --root=${ARCHIVE_NAME} ${CMAKE_BINARY_DIR}/${ARCHIVE_NAME}.tar.bz2
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)
add_custom_target(distcheck
COMMAND cd ${CMAKE_BINARY_DIR}
&& rm -rf ${ARCHIVE_NAME}
&& tar xf ${ARCHIVE_NAME}.tar.bz2
&& mkdir ${ARCHIVE_NAME}/build
&& cd ${ARCHIVE_NAME}/build
&& cmake -DCMAKE_INSTALL_PREFIX=../install ..
&& make
&& make install
&& make check
)
add_dependencies(distcheck dist)
configure_file(dbusmenu-qt.pc.in ${CMAKE_BINARY_DIR}/dbusmenu-${QT_SUFFIX}.pc @ONLY)
install(FILES ${CMAKE_BINARY_DIR}/dbusmenu-${QT_SUFFIX}.pc
DESTINATION ${LIB_DESTINATION}/pkgconfig
)
add_subdirectory(src)
if (NOT USE_QT5) # TODO port tests to Qt5
add_subdirectory(tests)
endif()
add_subdirectory(tools)
if(WITH_DOC)
configure_file(Doxyfile.in ${CMAKE_BINARY_DIR}/Doxyfile @ONLY)
add_custom_target(doc ALL doxygen
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
)
install(DIRECTORY ${CMAKE_BINARY_DIR}/html/
DESTINATION share/doc/libdbusmenu-${QT_SUFFIX}-doc
)
endif(WITH_DOC)
|