CMakeLists.txt 2.78 KB
Newer Older
Bahadır Kandemir's avatar
Bahadır Kandemir committed
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
# Project name
PROJECT (comar)

# CMake 2.6 required
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)

# Application name
SET (APP_NAME "comar")
SET (APP_SUFFIX "3")

# Uncomment this for production releases.
SET (VERSION_SUFFIX "")
SET (FLAGS "-g -O0 -Werror -Wcast-align -Wno-uninitialized -Wall -fstrict-aliasing")

# 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
SET (LIBS python2.6
          dbus-1
          polkit-dbus)

# Include standard headers
INCLUDE_DIRECTORIES (include/
                     /usr/include/python2.6
                     /usr/include/dbus-1.0
                     /usr/lib/dbus-1.0/include
                     /usr/include/PolicyKit)

# Compile comar from specified sources
ADD_EXECUTABLE (comar ${SOURCES})

# Link comar to specified libraries
TARGET_LINK_LIBRARIES(comar ${LIBS} )

# Install comar to /usr/sbin/<app-name>
INSTALL (PROGRAMS comar
         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
         config/tr.org.pardus.comar.service
         config/tr.org.pardus.comar2.service
         DESTINATION /usr/share/dbus-1/system-services/)

# Install policies
# Install PK policies
INSTALL (DIRECTORY
         policy
         DESTINATION /usr/share/PolicyKit
         PATTERN ".svn" EXCLUDE)

# Install system bus policy under /etc/dbus-1/system.d/
INSTALL (FILES
         config/tr.org.pardus.comar.conf
         DESTINATION /etc/dbus-1/system.d)

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

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