# Copyright (c) 2017 - 2020 Samsung Electronics Co., Ltd All Rights Reserved # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # # @file CMakeLists.txt # @author Dariusz Michaluk # @author Jaroslaw Pelczar CMAKE_MINIMUM_REQUIRED(VERSION 2.6) ##### Configure project version when using ##### outdated tools like CMake v2 IF(POLICY CMP0048) CMAKE_POLICY(SET CMP0048 NEW) ENDIF() IF(CMAKE_VERSION VERSION_LESS 3.0) PROJECT(device-certificate-manager CXX C) SET(PROJECT_VERSION "2.0") ELSE() PROJECT(device-certificate-manager VERSION 2.0 LANGUAGES C CXX) ENDIF() INCLUDE(GNUInstallDirs) INCLUDE(FindPkgConfig) INCLUDE(CheckLibraryExists) INCLUDE(GenerateExportHeader) IF(NOT CMAKE_BUILD_TYPE) SET(CMAKE_BUILD_TYPE "RELEASE") ENDIF(NOT CMAKE_BUILD_TYPE) SET(CMAKE_C_FLAGS_DEBUG "-std=c11 -O0 -ggdb -Wp,-U_FORTIFY_SOURCE") SET(CMAKE_CXX_FLAGS_DEBUG "-std=c++17 -O0 -ggdb -Wp,-U_FORTIFY_SOURCE") SET(CMAKE_C_FLAGS_RELEASE "-std=c11 -O2 -DNDEBUG") SET(CMAKE_CXX_FLAGS_RELEASE "-std=c++17 -O2 -DNDEBUG") ADD_DEFINITIONS("-Werror") ADD_DEFINITIONS("-Wall") ADD_DEFINITIONS("-Wextra") SET(CMAKE_POSITION_INDEPENDENT_CODE "True") SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pie") SET(DCM_UNIX_SOCKET_PATH "/run/device-certificate-manager.socket") ADD_DEFINITIONS(-DDCM_UNIX_SOCKET_PATH="${DCM_UNIX_SOCKET_PATH}") INCLUDE_DIRECTORIES(shared) ADD_SUBDIRECTORY(dcm-client) ADD_SUBDIRECTORY(dcm-daemon) ADD_SUBDIRECTORY(pkgconfig) ADD_SUBDIRECTORY(rpm) ADD_SUBDIRECTORY(systemd) ADD_SUBDIRECTORY(tests)