-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
81 lines (75 loc) · 4.75 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
cmake_minimum_required(VERSION 3.11)
project(scgi_prj VERSION 0.0 LANGUAGES CXX)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_CXX_EXTENSIONS OFF)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE release)
endif()
# Link this 'library' to use the following warnings
add_library(project_warnings INTERFACE)
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
target_compile_options(project_warnings INTERFACE /W4)
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
target_compile_options(project_warnings
INTERFACE
-Wall
-Wextra # reasonable and standard
-Wshadow # warn the user if a variable declaration shadows one from a
# parent context
-Wnon-virtual-dtor # warn the user if a class with virtual functions has a
# non-virtual destructor. This helps catch hard to
# track down memory errors
-Wold-style-cast # warn for c-style casts
-Wcast-align # warn for potential performance problem casts
-Wunused # warn on anything being unused
-Woverloaded-virtual # warn if you overload (not override) a virtual
# function
-Wpedantic # warn if non-standard C++ is used
-Wconversion # warn on type conversions that may lose data
-Wsign-conversion # warn on sign conversions
#-Wmisleading-indentation # warn if identation implies blocks where blocks
# do not exist
#-Wduplicated-cond # warn if if / else chain has duplicated conditions
#-Wduplicated-branches # warn if if / else branches have duplicated code
#-Wlogical-op # warn about logical operations being used where bitwise were
# probably wanted
-Wnull-dereference # warn if a null dereference is detected
#-Wuseless-cast # warn if you perform a cast to the same type
-Wdouble-promotion # warn if float is implicit promoted to double
-Wformat=2 # warn on security issues around functions that format output
# (ie printf)
)
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
target_compile_options(project_warnings
INTERFACE
-Wall
-Wextra # reasonable and standard
-Wshadow # warn the user if a variable declaration shadows one from a
# parent context
-Wnon-virtual-dtor # warn the user if a class with virtual functions has a
# non-virtual destructor. This helps catch hard to
# track down memory errors
-Wold-style-cast # warn for c-style casts
-Wcast-align # warn for potential performance problem casts
-Wunused # warn on anything being unused
-Woverloaded-virtual # warn if you overload (not override) a virtual
# function
-Wpedantic # warn if non-standard C++ is used
-Wconversion # warn on type conversions that may lose data
-Wsign-conversion # warn on sign conversions
-Wmisleading-indentation # warn if identation implies blocks where blocks
# do not exist
-Wduplicated-cond # warn if if / else chain has duplicated conditions
-Wduplicated-branches # warn if if / else branches have duplicated code
-Wlogical-op # warn about logical operations being used where bitwise were
# probably wanted
-Wnull-dereference # warn if a null dereference is detected
-Wuseless-cast # warn if you perform a cast to the same type
-Wdouble-promotion # warn if float is implicit promoted to double
-Wformat=2 # warn on security issues around functions that format output
# (ie printf)
)
endif()
add_subdirectory(thirdparty)
add_subdirectory(libscgi)
add_subdirectory(ba_co)