-
Notifications
You must be signed in to change notification settings - Fork 5
/
CMakeLists.txt
128 lines (107 loc) · 3.65 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
120
121
122
123
124
125
126
127
128
# To build without debug output, run:
# cmake .. -DCMAKE_BUILD_TYPE=Release
cmake_minimum_required(VERSION 3.5)
# Add the tests subdirectory
add_subdirectory(tests)
# Do not print deprecated warnings for Qt5 or KF5
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated-declarations")
project(launch LANGUAGES CXX)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# TODO: Make everything compile under Qt6
find_package(QT NAMES Qt5 REQUIRED COMPONENTS Widgets DBus Core)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets DBus Core)
find_package(KF5WindowSystem REQUIRED)
# Do not put qDebug() into Release builds
if(NOT CMAKE_BUILD_TYPE STREQUAL Debug)
add_definitions(-DQT_NO_DEBUG_OUTPUT)
endif()
# Set rpath
set(CMAKE_INSTALL_RPATH $ORIGIN/../lib)
# FIXME: Instead of building the same source code three times
# under different names, find a way to install symlinks to the
# 'launch' binary in different paths
add_executable(launch
src/launch.cpp
src/DbManager.h
src/DbManager.cpp
src/ApplicationInfo.h
src/ApplicationInfo.cpp
src/AppDiscovery.h
src/AppDiscovery.cpp
src/extattrs.h
src/extattrs.cpp
src/launcher.h
src/launcher.cpp
src/ApplicationSelectionDialog.h
src/ApplicationSelectionDialog.cpp
src/ApplicationSelectionDialog.ui
src/Executable.cpp
src/Executable.h
)
add_executable(open
src/launch.cpp
src/DbManager.h
src/DbManager.cpp
src/ApplicationInfo.h
src/ApplicationInfo.cpp
src/AppDiscovery.h
src/AppDiscovery.cpp
src/extattrs.h
src/extattrs.cpp
src/launcher.h
src/launcher.cpp
src/ApplicationSelectionDialog.h
src/ApplicationSelectionDialog.cpp
src/ApplicationSelectionDialog.ui
src/Executable.cpp
src/Executable.h
)
add_executable(xdg-open
src/launch.cpp
src/DbManager.h
src/DbManager.cpp
src/ApplicationInfo.h
src/ApplicationInfo.cpp
src/AppDiscovery.h
src/AppDiscovery.cpp
src/extattrs.h
src/extattrs.cpp
src/launcher.h
src/launcher.cpp
src/ApplicationSelectionDialog.h
src/ApplicationSelectionDialog.cpp
src/ApplicationSelectionDialog.ui
src/Executable.cpp
src/Executable.h
)
add_executable(bundle-thumbnailer
src/bundle-thumbnailer.cpp
src/DbManager.h
src/DbManager.cpp
src/extattrs.h
src/extattrs.cpp
)
if (CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
target_link_libraries(launch Qt${QT_VERSION_MAJOR}::Widgets Qt${QT_VERSION_MAJOR}::DBus KF5::WindowSystem procstat)
target_link_libraries(open Qt${QT_VERSION_MAJOR}::Widgets Qt${QT_VERSION_MAJOR}::DBus KF5::WindowSystem procstat)
target_link_libraries(xdg-open Qt${QT_VERSION_MAJOR}::Widgets Qt${QT_VERSION_MAJOR}::DBus KF5::WindowSystem procstat)
endif()
if (CMAKE_SYSTEM_NAME MATCHES "Linux")
target_link_libraries(launch Qt${QT_VERSION_MAJOR}::Widgets Qt${QT_VERSION_MAJOR}::DBus KF5::WindowSystem)
target_link_libraries(open Qt${QT_VERSION_MAJOR}::Widgets Qt${QT_VERSION_MAJOR}::DBus KF5::WindowSystem)
target_link_libraries(xdg-open Qt${QT_VERSION_MAJOR}::Widgets Qt${QT_VERSION_MAJOR}::DBus KF5::WindowSystem)
endif()
ADD_CUSTOM_TARGET(link_target ALL
COMMAND ${CMAKE_COMMAND} -E create_symlink launch open)
target_link_libraries(bundle-thumbnailer Qt${QT_VERSION_MAJOR}::Widgets)
# Allow for 'make install'
install(TARGETS launch open bundle-thumbnailer
RUNTIME DESTINATION bin)
# On most systems, sbin has priority on the $PATH over bin
install(TARGETS xdg-open
RUNTIME DESTINATION sbin)