forked from mongodb/genny
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
87 lines (74 loc) Β· 2.38 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
# Copyright 2019-present MongoDB Inc.
#
# 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.
cmake_minimum_required(VERSION 3.13 FATAL_ERROR)
cmake_policy(VERSION 3.13)
cmake_policy(SET CMP0110 OLD)
# NB: this version number is duplicated in
# src/CMakeList.txt, src/gennylib/CMakeLists.txt and src/gennylib/src/version.cpp
project(genny VERSION 0.0.1 LANGUAGES CXX)
# Include our local cmake folder in the module path
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
# Use our modules
include(Options)
include(CheckCompiler)
include(ConfigureInstall)
include(ParseAndAddCatchTests)
include(CreateGennyTargets)
if(${GENNY_BUILD_FLAT})
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib CACHE PATH "")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib CACHE PATH "")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin CACHE PATH "")
endif()
find_package(Threads REQUIRED)
# Grab OpenSSL right away
include(GetSsl)
# <Boost>
if(GENNY_STATIC_BOOST_PATH)
set(Boost_USE_STATIC_LIBS ON
CACHE BOOL "Use static Boost"
)
set(Boost_NO_SYSTEM_PATHS ON
CACHE BOOL "Use non-system Boost"
)
set(BOOST_ROOT "${GENNY_STATIC_BOOST_PATH}"
CACHE PATH "Use a specific path for Boost"
)
endif()
if(NOT Boost_USE_STATIC_LIBS)
add_definitions(-DBOOST_ALL_DYN_LINK)
endif()
# Prevent cmake from finding system boost instead of toolchain boost.
set(Boost_NO_BOOST_CMAKE ON)
set(Boost_USE_MULTITHREADED ON)
set(Boost_USE_STATIC_RUNTIME OFF)
find_package(
Boost
1.75
REQUIRED
COMPONENTS
filesystem
log_setup
log
program_options
)
# </Boost>
# <yaml-cpp>
find_package(yaml-cpp CONFIG REQUIRED)
# <yaml-cpp>
# Required CMAKE options
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_EXTENSIONS OFF CACHE BOOL "")
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
enable_testing()
add_subdirectory(src)