-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
69 lines (55 loc) · 2.25 KB
/
CMakeLists.txt
File metadata and controls
69 lines (55 loc) · 2.25 KB
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
cmake_minimum_required(VERSION 3.10)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED True)
project(clang_format_generator VERSION 0.1 DESCRIPTION "" LANGUAGES CXX)
enable_testing()
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
message(STATUS "build with GCC")
add_compile_options(-Wall
-Wextra
-Wshadow
-Wnon-virtual-dtor
-pedantic
-Wold-style-cast
-Wunused
-Wpedantic
-Wconversion
-Wcast-align
-Wsign-conversion
-Wmisleading-indentation
-Wduplicated-cond
-Wduplicated-branches
-Wlogical-op
-Wnull-dereference
-Wuseless-cast
-Wdouble-promotion
-Wformat=2
-Werror)
endif()
if(CMAKE_COMPILER_IS_GNUCXX)
option(BUILD_COVERAGE "Coverage Build" OFF)
if(BUILD_COVERAGE)
message(STATUS "Build coverage")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage -fprofile-arcs -ftest-coverage")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --coverage -fprofile-arcs -ftest-coverage")
endif()
option(BUILD_UBSAN "UndefinedBehaviorSanitizer Build" OFF)
if(BUILD_UBSAN)
message(STATUS "Build with UBSan")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=undefined -fno-omit-frame-pointer -fno-sanitize-recover")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=undefined")
endif()
option(BUILD_ASAN "AddressSanitizer Build" OFF)
if(BUILD_ASAN)
message(STATUS "Build with ASan")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -g")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=address")
endif()
option(BUILD_GPROF "gprof Build" OFF)
if(BUILD_GPROF)
message(STATUS "Build with gprof")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pg")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pg")
endif()
endif()
add_subdirectory(src)