-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
174 lines (153 loc) · 4.32 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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
cmake_minimum_required(VERSION 2.6.0 FATAL_ERROR)
set(PROJECT_NAME slim)
project(${PROJECT_NAME})
#Pretty colors
set(CMAKE_COLOR_MAKEFILE ON)
#Dont force verbose
set(CMAKE_VERBOSE_MAKEFILE ON)
#Include current dir
set(CMAKE_INCLUDE_CURRENT_DIR TRUE)
INCLUDE(CheckIncludeFile)
INCLUDE(CheckCCompilerFlag)
INCLUDE(CheckCXXCompilerFlag)
INCLUDE(CheckTypeSize)
# Version
set(SLIM_VERSION_MAJOR "1")
set(SLIM_VERSION_MINOR "3")
set(SLIM_VERSION_PATCH "4")
set(SLIM_VERSION "${SLIM_VERSION_MAJOR}.${SLIM_VERSION_MINOR}.${SLIM_VERSION_PATCH}")
set(CMAKE_INSTALL_PREFIX "/usr/local" CACHE PATH "Installation Directory")
set(PKGDATADIR "${CMAKE_INSTALL_PREFIX}/share/slim")
set(SYSCONFDIR "/etc")
set(MANDIR "${CMAKE_INSTALL_PREFIX}/share/man")
set(SLIM_DEFINITIONS)
if(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD" OR
${CMAKE_SYSTEM_NAME} MATCHES "NetBSD" OR
${CMAKE_SYSTEM_NAME} MATCHES "OpenBSD"
)
set(SLIM_DEFINITIONS ${SLIM_DEFINITIONS} "-DNEEDS_BASENAME")
else()
set(SLIM_DEFINITIONS ${SLIM_DEFINITIONS} "-DHAVE_SHADOW")
endif()
set(SLIM_DEFINITIONS ${SLIM_DEFINITIONS} "-DPACKAGE=\"slim\"")
set(SLIM_DEFINITIONS ${SLIM_DEFINITIONS} "-DVERSION=\"${SLIM_VERSION}\"")
set(SLIM_DEFINITIONS ${SLIM_DEFINITIONS} "-DPKGDATADIR=\"${PKGDATADIR}\"")
set(SLIM_DEFINITIONS ${SLIM_DEFINITIONS} "-DSYSCONFDIR=\"${SYSCONFDIR}\"")
# Flags
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -g -O2" )
set(CMAKE_CPP_FLAGS "${CMAKE_CPP_FLAGS} -Wall -g -O2" )
# source
set(slim_srcs
main.cpp
app.cpp
cfg.cpp
image.cpp
numlock.cpp
panel.cpp
switchuser.cpp
util.cpp
log.cpp
png.c
jpeg.c
)
if(USE_PAM)
set(slim_srcs ${slim_srcs} PAM.cpp)
endif(USE_PAM)
if(USE_CONSOLEKIT)
set(slim_srcs ${slim_srcs} Ck.cpp)
endif(USE_CONSOLEKIT)
add_executable(${PROJECT_NAME} ${slim_srcs})
#Set the custom CMake module directory where our include/lib finders are
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules")
find_package(X11 REQUIRED)
find_package(Freetype REQUIRED)
find_package(JPEG REQUIRED)
find_package(PNG REQUIRED)
find_package(ZLIB REQUIRED)
# Fontconfig
set(FONTCONFIG_DIR ${CMAKE_MODULE_PATH})
find_package(FONTCONFIG REQUIRED)
if(FONTCONFIG_FOUND)
message("\tFontConfig Found")
target_link_libraries(${PROJECT_NAME} ${FONTCONFIG_LIBRARY})
include_directories(${FONTCONFIG_INCLUDE_DIR})
endif(FONTCONFIG_FOUND)
# PAM
if(USE_PAM)
message("\tPAM Enabled")
find_package(PAM)
if(PAM_FOUND)
message("\tPAM Found")
set(SLIM_DEFINITIONS ${SLIM_DEFINITIONS} "-DUSE_PAM")
target_link_libraries(${PROJECT_NAME} ${PAM_LIBRARY})
include_directories(${PAM_INCLUDE_DIR})
else(PAM_FOUND)
message("\tPAM Not Found")
endif(PAM_FOUND)
else(USE_PAM)
message("\tPAM disabled")
endif(USE_PAM)
# ConsoleKit
if(USE_CONSOLEKIT)
find_package(CkConnector)
message("\tConsoleKit Enabled")
if(CKCONNECTOR_FOUND)
message("\tConsoleKit Found")
# DBus check
find_package(DBus REQUIRED)
if(DBUS_FOUND)
message("\tDBus Found")
target_link_libraries(${PROJECT_NAME} ${DBUS_LIBRARIES})
include_directories(${DBUS_ARCH_INCLUDE_DIR})
include_directories(${DBUS_INCLUDE_DIR})
set(SLIM_DEFINITIONS ${SLIM_DEFINITIONS} "-DUSE_CONSOLEKIT")
target_link_libraries(${PROJECT_NAME} ${CKCONNECTOR_LIBRARIES})
include_directories(${CKCONNECTOR_INCLUDE_DIR})
else(DBUS_FOUND)
message("\tDBus Not Found")
endif(DBUS_FOUND)
else(CKCONNECTOR_FOUND)
message("\tConsoleKit Not Found")
message("\tConsoleKit disabled")
endif(CKCONNECTOR_FOUND)
else(USE_CONSOLEKIT)
message("\tConsoleKit disabled")
endif(USE_CONSOLEKIT)
# system librarys
find_library(M_LIB m)
find_library(RT_LIB rt)
find_library(CRYPTO_LIB crypt)
add_definitions(${SLIM_DEFINITIONS})
#Set up include dirs with all found packages
include_directories(
${X11_INCLUDE_DIR}
${X11_Xft_INCLUDE_PATH}
${X11_Xrender_INCLUDE_PATH}
${FREETYPE_INCLUDE_DIR_freetype2}
${X11_Xmu_INCLUDE_PATH}
${ZLIB_INCLUDE_DIR}
${JPEG_INCLUDE_DIR}
${PNG_INCLUDE_DIR}
)
#Set up library with all found packages
target_link_libraries(${PROJECT_NAME}
${M_LIB}
${RT_LIB}
${CRYPTO_LIB}
${X11_X11_LIB}
${X11_Xft_LIB}
${X11_Xrender_LIB}
${X11_Xmu_LIB}
${FREETYPE_LIBRARY}
${JPEG_LIBRARIES}
${PNG_LIBRARIES}
)
####### install
# slim
install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION bin )
# man file
install(FILES slim.1 DESTINATION ${MANDIR}/man1/)
# configure
install(FILES slim.conf DESTINATION ${SYSCONFDIR})
# themes directory
subdirs(themes)