forked from eclipse/kuksa.val
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
101 lines (77 loc) · 3.09 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#
# ******************************************************************************
# Copyright (c) 2018 Robert Bosch GmbH and others.
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v2.0
# which accompanies this distribution, and is available at
# https://www.eclipse.org/org/documents/epl-2.0/index.php
#
# Contributors:
# Robert Bosch GmbH - initial API and functionality
# *****************************************************************************
cmake_minimum_required(VERSION 3.12.0)
project(kuksa-val VERSION 2.0.1 LANGUAGES CXX)
# Generate compile_commands.json
set(CMAKE_EXPORT_COMPILE_COMMANDS "ON")
# Compiler setting
add_compile_options(-Wfatal-errors)
find_program(CCACHE_BIN ccache)
if(CCACHE_BIN)
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ${CCACHE_BIN})
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ${CCACHE_BIN})
message("Use ccache from ${CCACHE_BIN}")
endif()
#####
# Create buildinfo
#
set(PRE_CONFIGURE_FILE "buildinfo.h.in")
set(POST_CONFIGURE_FILE "buildinfo.h")
include(git_watcher.cmake)
######
# Root CMake file responsible for setting up mandatory dependencies
# and any other global information
###
# Default option setup
# If not provided otherwise, set build type as 'Release'
if (NOT CMAKE_BUILD_TYPE OR CMAKE_BUILD_TYPE STREQUAL "")
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Default build type" FORCE)
endif()
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
###
# System library includes
# Prefer pthread as threading library
set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
set(THREADS_PREFER_PTHREAD_FLAG TRUE)
find_package(Threads REQUIRED)
# Boost
include(boost.cmake)
include(grpc.cmake)
# OpenSSL
find_package(OpenSSL REQUIRED)
message(STATUS "openssl libraries ${OPENSSL_LIBRARIES}")
FIND_PACKAGE(PkgConfig)
# mosquitto
find_path(MOSQUITTO_INCLUDE_DIR NAMES mosquitto.h )
find_library(MOSQUITTO_LIBRARY NAMES mosquitto )
include(FindPackageHandleStandardArgs)
# handle the QUIETLY and REQUIRED arguments and set VILLASNODE_FOUND to TRUE
# if all listed variables are TRUE
find_package_handle_standard_args(Mosquitto DEFAULT_MSG MOSQUITTO_LIBRARY MOSQUITTO_INCLUDE_DIR)
###
# 3rd-party library includes already available in git repo
add_library(jsoncons INTERFACE)
target_include_directories(jsoncons SYSTEM INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/3rd-party-libs/jsoncons/include/)
add_library(jsonpath INTERFACE)
target_include_directories(jsonpath SYSTEM INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/3rd-party-libs/jsoncons/include/jsoncons_ext)
add_library(jwt-cpp INTERFACE)
target_include_directories(jwt-cpp SYSTEM INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/3rd-party-libs/jwt-cpp/include)
add_library(turtle INTERFACE)
target_include_directories(turtle SYSTEM INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/3rd-party-libs/turtle/include)
###
# Add project subdirectories to build
add_subdirectory(src)
enable_testing()
include(CTest)
add_subdirectory(test)
add_subdirectory(test/unit-test)