CMakeLists.txt 2.02 KB
Newer Older
Ana Custura's avatar
Ana Custura 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
project(chkservice)

cmake_minimum_required(VERSION 2.8)

set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

if ($ENV{DEBUG})
  message(STATUS "DEBUG mode enabled")
  set (CMAKE_CXX_FLAGS "-g -Wall")
else()
  message(STATUS "DEBUG mode disabled")
  set (CMAKE_CXX_FLAGS "-O2")
endif()

if ($ENV{TRAVIS})
  message(STATUS "Travis-CI build.")
else()
  message(STATUS "Local build")
endif()

include_directories("${PROJECT_SOURCE_DIR}/include")

find_package(PkgConfig REQUIRED)

pkg_check_modules(SYSTEMD libsystemd REQUIRED)

include_directories(${SYSTEMD_INCLUDE_DIRS})
set(LIBS ${LIBS} ${SYSTEMD_LIBRARIES})

pkg_check_modules(NCURSES ncurses REQUIRED)

include_directories(${NCURSES_INCLUDE_DIRS})
set(LIBS ${LIBS} ${NCURSES_LIBRARIES})

add_subdirectory(${PROJECT_SOURCE_DIR}/src)

if ($ENV{DEBUG})
  message(STATUS "Build testing support")
  add_subdirectory(${PROJECT_SOURCE_DIR}/tests)
endif()

SET(MAJOR_VERSION 0)
SET(MINOR_VERSION 1)
SET(PATCH_VERSION 0)

IF(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")
INCLUDE(InstallRequiredSystemLibraries)

SET(CPACK_SET_DESTDIR "on")
SET(CPACK_PACKAGING_INSTALL_PREFIX "/tmp")
SET(CPACK_GENERATOR "DEB")

SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Ncurses based gui for systemd")
SET(CPACK_PACKAGE_VENDOR "Svetlana Linuxenko")
SET(CPACK_PACKAGE_CONTACT "sveta@linuxenko.pro")
SET(CPACK_PACKAGE_VERSION_MAJOR "${MAJOR_VERSION}")
SET(CPACK_PACKAGE_VERSION_MINOR "${MINOR_VERSION}")
SET(CPACK_PACKAGE_VERSION_PATCH "${PATCH_VERSION}")
SET(CPACK_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}_${MAJOR_VERSION}.${MINOR_VERSION}.${CPACK_PACKAGE_VERSION_PATCH}")
SET(CPACK_SOURCE_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}_${MAJOR_VERSION}.${MINOR_VERSION}.${CPACK_PACKAGE_VERSION_PATCH}")

SET(CPACK_DEBIAN_PACKAGE_DEPENDS "libncurses5 (>=5), libsystemd0 (>= 222)")

SET(CPACK_DEBIAN_PACKAGE_PRIORITY "optional")
SET(CPACK_DEBIAN_PACKAGE_SECTION "utils")
SET(CPACK_DEBIAN_ARCHITECTURE ${CMAKE_SYSTEM_PROCESSOR})

SET(CPACK_COMPONENTS_ALL Libraries ApplicationData)
INCLUDE(CPack)

ENDIF(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")