This repository has been archived by the owner on Oct 23, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
CMakeLists.txt
73 lines (59 loc) · 2.24 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
cmake_minimum_required(VERSION 3.7)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
list(APPEND CMAKE_PREFIX_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
enable_language(CXX)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
include(HunterGate)
include(AddressSanitizer)
include(MemorySanitizer)
include(ThreadSanitizer)
include(UndefinedSanitizer)
include(RemoveFlags)
huntergate(URL
"https://github.com/ruslo/hunter/archive/v0.23.54.tar.gz"
SHA1
"64ae727ebaec586c84da5d69e5c37b5962baccd6"
FILEPATH
"${CMAKE_CURRENT_LIST_DIR}/cmake/config.cmake")
set(CMAKE_POSITION_INDEPENDENT_CODE TRUE)
# extract project version from git tag
execute_process(COMMAND git describe --tags
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE GIT_FULL_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE)
# cmake project version must be major.minor.patch with all integers.
# GIT_FULL_VERSION is accurate even for branch not tagged the format of
# GIT_FULL_VERSION is v1.2.3-gsha1 or v1.2.3
execute_process(COMMAND echo ${GIT_FULL_VERSION}
COMMAND grep -o "[0-9][0-9]*\\.[0-9][0-9]*\\.[0-9][0-9]*"
OUTPUT_VARIABLE GIT_LAST_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE)
project(task-maker VERSION ${GIT_LAST_VERSION})
include(CTest)
enable_testing()
include(GoogleTest)
find_package(PythonInterp 3.5 REQUIRED)
# Enable colors in ninja
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fdiagnostics-color=always")
# Other flags
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wno-unused-parameter -g")
set(CMAKE_CXX_FLAGS_RELEASE "-O3")
# if hunter is disabled all these lines are noop
hunter_add_package(GTest)
hunter_add_package(CapnProto)
hunter_add_package(pybind11)
# these finders are bundled with cmake
find_package(GTest REQUIRED)
# these finders are provided by hunter, when hunter is disabled the ones in
# cmake are used
find_package(CapnProto CONFIG REQUIRED)
find_package(GMock CONFIG REQUIRED)
find_package(pybind11 CONFIG REQUIRED)
find_package(dw CONFIG)
add_subdirectory(capnp)
add_subdirectory(third_party)
add_subdirectory(cpp)
add_subdirectory(python)
add_subdirectory(tools)