c++17: Use fold expression with std::apply
[platform/core/security/vist.git] / CMakeLists.txt
1 #  Copyright (c) 2019 Samsung Electronics Co., Ltd All Rights Reserved
2 #
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
6 #
7 #      http://www.apache.org/licenses/LICENSE-2.0
8 #
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
14
15 CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
16 PROJECT(vist)
17
18 INCLUDE(GNUInstallDirs)
19 INCLUDE(CMake/Macro.cmake)
20
21 IF(DEFINED GBS_BUILD)
22         INCLUDE(FindPkgConfig)
23 ELSE(DEFINED GBS_BUILD)
24         INCLUDE(CMake/Definition.cmake)
25 ENDIF(DEFINED GBS_BUILD)
26
27 IF(NOT CMAKE_BUILD_TYPE)
28         SET(CMAKE_BUILD_TYPE "DEBUG")
29 ENDIF(NOT CMAKE_BUILD_TYPE)
30
31 SET(CMAKE_CXX_FLAGS_DEBUG   "-g -std=c++1z -O0 -ggdb -Wp,-U_FORTIFY_SOURCE")
32 SET(CMAKE_CXX_FLAGS_RELEASE "-g -std=c++1z -O2 -DNDEBUG")
33
34 SET(CMAKE_SHARED_LINKER_FLAGS  "-Wl,--as-needed")
35 SET(CMAKE_EXE_LINKER_FLAGS     "-Wl,--as-needed")
36
37 ADD_DEFINITIONS("-fPIC")
38 ADD_DEFINITIONS("-Wno-ignored-qualifiers") # Suppress osquery error
39
40 # Set various platform/platform-version/build version/etc defines.
41 ADD_DEFINITIONS(-DLINUX="1"
42                                 -DPOSIX="1"
43                                 -DOSQUERY_LINUX="1"
44                                 -DOSQUERY_POSIX="1"
45                                 -DOSQUERY_BUILD_PLATFORM="linux"
46                                 -DOSQUERY_BUILD_DISTRO="linux")
47
48 ADD_DEFINITIONS(-DOSQUERY_VERSION=${OSQUERY_VERSION}
49                                 -DOSQUERY_BUILD_VERSION=${OSQUERY_VERSION}
50                                 -DOSQUERY_BUILD_SDK_VERSION=${OSQUERY_VERSION})
51
52 INCLUDE_DIRECTORIES("${CMAKE_SOURCE_DIR}/src")
53 INCLUDE_DIRECTORIES("${CMAKE_SOURCE_DIR}/src/osquery/include")
54 INCLUDE_DIRECTORIES("/usr/local/include")
55
56 ENABLE_TESTING()
57
58 # Make sure the generated paths exist
59 EXECUTE_PROCESS(COMMAND mkdir -p "${CMAKE_BINARY_DIR}/generated")
60
61 ADD_SUBDIRECTORY(data)
62 ADD_SUBDIRECTORY(specs)
63 ADD_SUBDIRECTORY(src)
64 ADD_SUBDIRECTORY(plugins)
65
66 IF(DEFINED GBS_BUILD)
67         ADD_SUBDIRECTORY(systemd)
68 ENDIF(DEFINED GBS_BUILD)