-
Notifications
You must be signed in to change notification settings - Fork 5
/
CMakeLists.txt
78 lines (54 loc) · 1.51 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
cmake_minimum_required(VERSION 3.11)
project(keygen VERSION 0.5.8)
message(STATUS "~~ ${PROJECT_NAME} ${PROJECT_VERSION} ~~")
message(STATUS "Build Type : ${CMAKE_BUILD_TYPE}")
option(UNITTEST "Builds unit tests" ON)
message(STATUS "Building Unit Tests : ${UNITTEST}")
option(COVERAGE "Enables source code coverage" OFF)
message(STATUS "Test coverage : ${COVERAGE}")
option(SANITIZER_ASAN "Enable ASan" OFF)
message(STATUS "ASan : ${SANITIZER_ASAN}")
option(SANITIZER_UBSAN "Enable UBSan" OFF)
message(STATUS "UBSan : ${SANITIZER_UBSAN}")
option(DOXYGEN "Generate Doxygen documentation" OFF)
message(STATUS "Doxygen : ${DOXYGEN}")
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
find_package(OpenSSL REQUIRED)
message(STATUS "Using OpenSSL ${OPENSSL_VERSION}")
set(CMAKE_C_STANDARD 11)
set(CMAKE_C_STANDARD_REQUIRED ON)
set(CMAKE_C_EXTENSIONS OFF)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
include(CompilerOptions)
add_common_flags(-Wall
-Wextra
-Werror
-pedantic
-pedantic-errors
-Wshadow
-Wnull-dereference
-Wconversion
-Wsign-conversion
)
add_cpp_flags(-Wold-style-cast
-Wold-style-cast
-Wnon-virtual-dtor
-Woverloaded-virtual
)
include(Sanitizer)
include(Memcheck)
include(ClangFormat)
if( COVERAGE )
include(Coverage)
endif()
include_directories("include")
add_subdirectory(src)
if( UNITTEST )
enable_testing()
add_subdirectory(test)
endif()
if( DOXYGEN )
include(Doxygen)
endif()