-
Notifications
You must be signed in to change notification settings - Fork 12
/
CMakeLists.txt
92 lines (66 loc) · 3.14 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
cmake_minimum_required(VERSION 3.2)
project(ark_cpp_client)
# ------------------------------------------------------------------------------
# Set the Environment Variables
# ------------------------------------------------------------------------------
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_INSTALL_PREFIX ${PROJECT_SOURCE_DIR})
set(EXTERNAL_LIBRARY_DIR ${PROJECT_SOURCE_DIR}/extern)
set(BUILD_SHARED_LIBS OFF)
if (MSVC)
add_definitions(-D_CRT_SECURE_NO_WARNINGS
-D_SCL_SECURE_NO_WARNINGS
-DNOMINMAX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /utf-8")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MT")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MTd")
else()
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} -g")
endif()
# ------------------------------------------------------------------------------
# ------------------------------------------------------------------------------
# Coverage 1:2
# ------------------------------------------------------------------------------
if (CMAKE_BUILD_TYPE STREQUAL "Coverage")
add_definitions(-Wno-unused-command-line-argument)
endif() #CMAKE_BUILD_TYPE STREQUAL "Coverage"
# ------------------------------------------------------------------------------
# ------------------------------------------------------------------------------
# Clang Tidy
# ------------------------------------------------------------------------------
if(ENABLE_CLANG_TIDY)
find_program(CLANG_TIDY_BIN clang-tidy-5.0)
find_program(RUN_CLANG_TIDY_BIN run-clang-tidy-5.0.py)
if(CLANG_TIDY_BIN STREQUAL "CLANG_TIDY_BIN-NOTFOUND")
message(FATAL_ERROR "unable to locate clang-tidy-5.0")
endif()
if(RUN_CLANG_TIDY_BIN STREQUAL "RUN_CLANG_TIDY_BIN-NOTFOUND")
message(FATAL_ERROR "unable to locate run-clang-tidy-5.0.py")
endif()
list(APPEND RUN_CLANG_TIDY_BIN_ARGS
-clang-tidy-binary ${CLANG_TIDY_BIN}
-header-filter="\".*\\b(cpp-client/src)\""
-checks=clan*,cert*,misc*,perf*,cppc*,read*,mode*,-cert-err58-cpp,-misc-noexcept-move-constructor,-cppcoreguidelines-*)
add_custom_target(tidy
COMMAND ${RUN_CLANG_TIDY_BIN} ${RUN_CLANG_TIDY_BIN_ARGS}
COMMENT "running clang tidy")
endif()
# ------------------------------------------------------------------------------
# ------------------------------------------------------------------------------
# Add the ARK C++ Client Library Subdirectory
# ------------------------------------------------------------------------------
add_subdirectory(src)
# ------------------------------------------------------------------------------
# ------------------------------------------------------------------------------
# Add the ARK C++ Client Test Subdirectory
#
# Disabled by default.
#
# Use `cmake -DUNIT_TEST=ON ..` to enable Test building.
# ------------------------------------------------------------------------------
option(UNIT_TEST "Tests disabled by default" OFF)
if(UNIT_TEST)
add_subdirectory(test)
endif()
# ------------------------------------------------------------------------------