1 # Copyright (c) 2017 - 2020 Samsung Electronics Co., Ltd All Rights Reserved
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
7 # http://www.apache.org/licenses/LICENSE-2.0
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
15 # @file CMakeLists.txt
16 # @author Dariusz Michaluk <d.michaluk@samsung.com>
17 # @author Jaroslaw Pelczar <j.pelczar@samsung.com>
19 CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
21 ##### Configure project version when using
22 ##### outdated tools like CMake v2
25 CMAKE_POLICY(SET CMP0048 NEW)
28 IF(CMAKE_VERSION VERSION_LESS 3.0)
29 PROJECT(device-certificate-manager CXX C)
30 SET(PROJECT_VERSION "2.0")
32 PROJECT(device-certificate-manager VERSION 2.0 LANGUAGES C CXX)
35 INCLUDE(GNUInstallDirs)
36 INCLUDE(FindPkgConfig)
37 INCLUDE(CheckLibraryExists)
38 INCLUDE(GenerateExportHeader)
40 IF(NOT CMAKE_BUILD_TYPE)
41 SET(CMAKE_BUILD_TYPE "RELEASE")
42 ENDIF(NOT CMAKE_BUILD_TYPE)
44 SET(CMAKE_C_FLAGS_DEBUG "-std=c11 -O0 -ggdb -Wp,-U_FORTIFY_SOURCE")
45 SET(CMAKE_CXX_FLAGS_DEBUG "-std=c++17 -O0 -ggdb -Wp,-U_FORTIFY_SOURCE")
46 SET(CMAKE_C_FLAGS_RELEASE "-std=c11 -O2 -DNDEBUG")
47 SET(CMAKE_CXX_FLAGS_RELEASE "-std=c++17 -O2 -DNDEBUG")
49 ADD_DEFINITIONS("-Werror")
50 ADD_DEFINITIONS("-Wall")
51 ADD_DEFINITIONS("-Wextra")
53 SET(CMAKE_POSITION_INDEPENDENT_CODE "True")
54 SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pie")
56 SET(DCM_UNIX_SOCKET_PATH "/run/device-certificate-manager.socket")
57 ADD_DEFINITIONS(-DDCM_UNIX_SOCKET_PATH="${DCM_UNIX_SOCKET_PATH}")
59 INCLUDE_DIRECTORIES(shared)
60 ADD_SUBDIRECTORY(dcm-client)
61 ADD_SUBDIRECTORY(dcm-daemon)
62 ADD_SUBDIRECTORY(pkgconfig)
64 ADD_SUBDIRECTORY(systemd)
65 ADD_SUBDIRECTORY(tests)