CMakeLists.txt 2.74 KB
Newer Older
Bahadır Kandemir's avatar
Bahadır Kandemir committed
1
# Project name
2
PROJECT (scom)
Bahadır Kandemir's avatar
Bahadır Kandemir committed
3 4 5 6

# CMake 2.6 required
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)

7
# Python is required
8
FIND_PACKAGE(PythonLibs 3)
9

10 11 12
FIND_PACKAGE(PkgConfig)
PKG_CHECK_MODULES (DBUS REQUIRED dbus-1)

Bahadır Kandemir's avatar
Bahadır Kandemir committed
13
# Application name
14
SET (APP_NAME "scom")
Bahadır Kandemir's avatar
Bahadır Kandemir committed
15 16 17 18
SET (APP_SUFFIX "3")

# Uncomment this for production releases.
SET (VERSION_SUFFIX "")
Suleyman Poyraz's avatar
Suleyman Poyraz committed
19
#SET (FLAGS "-g -O0 -Wcast-align -Wno-uninitialized -Wall -fstrict-aliasing")
Bahadır Kandemir's avatar
Bahadır Kandemir committed
20

Suleyman Poyraz's avatar
Suleyman Poyraz committed
21
SET (FLAGS "-g -O0 -Wno-uninitialized -Wall -fstrict-aliasing")
Bahadır Kandemir's avatar
Bahadır Kandemir committed
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
# Uncomment this for gprof profiling
# SET (FLAGS "-g -O0 -Werror -Wcast-align -Wno-uninitialized -Wall -fstrict-aliasing -fprofile-arcs -ftest-coverage")
SET (CMAKE_C_FLAGS "${FLAGS}")
# Uncomment this for sparse building
# SET (CMAKE_C_COMPILER cgcc)

# Append name suffix, if specified
IF (APP_SUFFIX)
   SET (APP_NAME "${APP_NAME}${APP_SUFFIX}")
ENDIF (APP_SUFFIX)

# Define version, config dir, data dir and log file.
ADD_DEFINITIONS (
                 -D'PID_FILE="/var/run/${APP_NAME}.pid"'
                 -D'DATA_DIR="/var/lib/${APP_NAME}"'
                 -D'LOG_DIR="/var/log/${APP_NAME}"')

# Set standard sources
SET (SOURCES src/main.c
             src/bus.c
             src/config.c
             src/db.c
             src/iksemel.c
             src/log.c
             src/loop.c
             src/process.c
             src/policy.c
             src/pydbus.c
             src/script.c
             src/utils.c)

# Set standard libraries
54
SET (LIBS ${PYTHON_LIBRARIES}
Bahadır Kandemir's avatar
Bahadır Kandemir committed
55
          dbus-1)
Bahadır Kandemir's avatar
Bahadır Kandemir committed
56 57 58

# Include standard headers
INCLUDE_DIRECTORIES (include/
59
                     ${PYTHON_INCLUDE_DIRS}
60
                     ${DBUS_INCLUDE_DIRS})
Bahadır Kandemir's avatar
Bahadır Kandemir committed
61

62 63
# Compile scom from specified sources
ADD_EXECUTABLE (scom ${SOURCES})
Bahadır Kandemir's avatar
Bahadır Kandemir committed
64

65 66
# Link scom to specified libraries
TARGET_LINK_LIBRARIES(scom ${LIBS} )
Bahadır Kandemir's avatar
Bahadır Kandemir committed
67

68 69
# Install scom to /usr/sbin/<app-name>
INSTALL (PROGRAMS scom
Bahadır Kandemir's avatar
Bahadır Kandemir committed
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
         DESTINATION /usr/sbin)

# Install Models
INSTALL (DIRECTORY
        models
        DESTINATION /var/db/${APP_NAME}
        PATTERN ".svn" EXCLUDE)

# Install Modules
INSTALL (DIRECTORY
        modules
        DESTINATION /var/db/${APP_NAME}
        PATTERN ".svn" EXCLUDE)

# Install service activation config under /usr/share/dbus-1/system-services/
INSTALL (FILES
86 87
         config/tr.org.sulin.scom.service
         config/tr.org.sulin.scom2.service
Bahadır Kandemir's avatar
Bahadır Kandemir committed
88 89
         DESTINATION /usr/share/dbus-1/system-services/)

Ozan Çağlayan's avatar
Ozan Çağlayan committed
90
# Install polkit policies
Bahadır Kandemir's avatar
Bahadır Kandemir committed
91
INSTALL (DIRECTORY
Ozan Çağlayan's avatar
Ozan Çağlayan committed
92 93
         policy/
         DESTINATION /usr/share/polkit-1/actions
Ozan Çağlayan's avatar
Ozan Çağlayan committed
94
         FILES_MATCHING PATTERN "*.policy"
Bahadır Kandemir's avatar
Bahadır Kandemir committed
95 96 97 98
         PATTERN ".svn" EXCLUDE)

# Install system bus policy under /etc/dbus-1/system.d/
INSTALL (FILES
99
         config/tr.org.sulin.scom.conf
Bahadır Kandemir's avatar
Bahadır Kandemir committed
100 101 102 103 104 105
         DESTINATION /etc/dbus-1/system.d)

# Install hav to /usr/bin/hav
INSTALL (PROGRAMS tools/hav.py
         DESTINATION /usr/bin
         RENAME hav)