1 # Copyright (c) 2019 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 CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
18 INCLUDE(GNUInstallDirs)
19 INCLUDE(CMake/Macro.cmake)
22 INCLUDE(FindPkgConfig)
23 ELSE(DEFINED GBS_BUILD)
24 INCLUDE(CMake/Definition.cmake)
25 ENDIF(DEFINED GBS_BUILD)
27 IF(NOT CMAKE_BUILD_TYPE)
28 SET(CMAKE_BUILD_TYPE "DEBUG")
29 ENDIF(NOT CMAKE_BUILD_TYPE)
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")
34 SET(CMAKE_SHARED_LINKER_FLAGS "-Wl,--as-needed")
35 SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed")
37 ADD_DEFINITIONS("-fPIC")
38 ADD_DEFINITIONS("-Wno-ignored-qualifiers") # Suppress osquery error
40 # Set various platform/platform-version/build version/etc defines.
41 ADD_DEFINITIONS(-DLINUX="1"
45 -DOSQUERY_BUILD_PLATFORM="linux"
46 -DOSQUERY_BUILD_DISTRO="linux")
48 ADD_DEFINITIONS(-DOSQUERY_VERSION=${OSQUERY_VERSION}
49 -DOSQUERY_BUILD_VERSION=${OSQUERY_VERSION}
50 -DOSQUERY_BUILD_SDK_VERSION=${OSQUERY_VERSION})
52 INCLUDE_DIRECTORIES("${CMAKE_SOURCE_DIR}/src")
53 INCLUDE_DIRECTORIES("${CMAKE_SOURCE_DIR}/src/osquery/include")
54 INCLUDE_DIRECTORIES("/usr/local/include")
58 # Make sure the generated paths exist
59 EXECUTE_PROCESS(COMMAND mkdir -p "${CMAKE_BINARY_DIR}/generated")
61 ADD_SUBDIRECTORY(data)
62 ADD_SUBDIRECTORY(specs)
64 ADD_SUBDIRECTORY(plugins)
67 ADD_SUBDIRECTORY(systemd)
68 ENDIF(DEFINED GBS_BUILD)