1 ###########################################################################
2 # Copyright (C) 2018 "IoT.bzh"
4 # author: José Bollo <jose.bollo@iot.bzh>
6 # Licensed under the Apache License, Version 2.0 (the "License");
7 # you may not use this file except in compliance with the License.
8 # You may obtain a copy of the License at
10 # http://www.apache.org/licenses/LICENSE-2.0
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS,
14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 # See the License for the specific language governing permissions and
16 # limitations under the License.
17 ###########################################################################
19 cmake_minimum_required(VERSION 3.0)
22 DESCRIPTION "Secured permission database for applications"
23 HOMEPAGE_URL "https://gerrit.automotivelinux.org/gerrit/gitweb?p=src/cynagora.git;a=summary"
28 include(FindPkgConfig)
29 include(CheckIncludeFiles)
30 include(CheckLibraryExists)
31 include(GNUInstallDirs)
34 if(NOT CMAKE_INSTALL_FULL_RUNSTATEDIR)
35 set(CMAKE_INSTALL_FULL_RUNSTATEDIR "${CMAKE_INSTALL_FULL_LOCALSTATEDIR}/run")
38 ###########################################################################
41 set(CYNAGORA_VERSION ${PROJECT_VERSION})
42 set(CYNAGORA_SOVERSION ${PROJECT_VERSION_MAJOR})
44 option(WITH_SYSTEMD "should include systemd compatibility" ON)
45 option(WITH_CYNARA_COMPAT "produce artifacts for compatibility with cynara" OFF)
47 set(USER cynagora CACHE STRING "user of the daemon")
48 set(GROUP cynagora CACHE STRING "group of the daemon")
50 set(DEFAULT_DB_DIR "${CMAKE_INSTALL_FULL_LOCALSTATEDIR}/lib/cynagora"
51 CACHE PATH "directory path of the database")
52 set(DEFAULT_SOCKET_DIR "${CMAKE_INSTALL_FULL_RUNSTATEDIR}/cynagora"
53 CACHE PATH "directory path of the sockets")
54 set(DEFAULT_INIT_FILE "${CMAKE_INSTALL_FULL_SYSCONFDIR}/security/cynagora.initial")
56 ###########################################################################
58 link_libraries(-Wl,--as-needed -Wl,--gc-sections -Wl,--no-undefined)
60 add_compile_options(-Wall -Wextra -Wconversion)
61 add_compile_options(-Wno-unused-parameter) # frankly not using a parameter does it care?
62 add_compile_options(-Werror=maybe-uninitialized)
63 add_compile_options(-Werror=implicit-function-declaration)
64 add_compile_options(-ffunction-sections -fdata-sections)
65 #add_compile_options(-ffile-prefix-map=${CMAKE_SOURCE_DIR}=.)
67 ###########################################################################
70 PKG_CHECK_MODULES(libsystemd REQUIRED libsystemd>=222)
71 add_subdirectory(systemd)
75 add_subdirectory(pkgconfig)
77 if(WITH_CYNARA_COMPAT)
78 add_subdirectory(compat)
81 get_filename_component(
82 DEFAULT_INIT_FILE_DIRECTORY
87 ${CMAKE_CURRENT_SOURCE_DIR}/cynagora.initial
89 ${DEFAULT_INIT_FILE_DIRECTORY}