summaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
blob: a044dca7c30006a1c18083fbfdd56d53abeea2f5 (plain) (blame)
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
cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR)

# cmake -G"Eclipse CDT4 - Unix Makefiles" -D CMAKE_BUILD_TYPE=Debug ..

# project name
project(idle-daemon C)

option(CMAKE_BUILD_TYPE Release)
set(CMAKE_C_FLAGS "-D_GNU_SOURCE")
set(CMAKE_C_FLAGS_DEBUG "-O0 -g -Wall -Wextra -pedantic -Werror -Wno-multichar -Wstrict-prototypes -Wmissing-prototypes -Wno-overlength-strings")
set(CMAKE_C_FLAGS_RELEASE "-O2 -Wno-multichar")

file(GLOB_RECURSE IDLEDAEMON_SOURCES src/*.c)

include_directories(
  ${CMAKE_CURRENT_SOURCE_DIR}/src
  ${CMAKE_CURRENT_BINARY_DIR}
  ${X11_INCLUDE_DIR}
)

FIND_PACKAGE(X11 REQUIRED)

IF(NOT X11_Xscreensaver_FOUND)
    MESSAGE(FATAL_ERROR "Could not find X11 extension Xscreensaver")
ENDIF()
IF(NOT X11_dpms_FOUND)
    MESSAGE(FATAL_ERROR "Could not find X11 extension dpms")
ENDIF()


#
# build idle-daemon
#
add_executable(idle-daemon
  ${IDLEDAEMON_SOURCES}
)

target_link_libraries(idle-daemon
  ${X11_LIBRARIES}
  ${X11_Xscreensaver_LIB}
)

install(TARGETS idle-daemon RUNTIME DESTINATION sbin)