blob: 2ecb4952a6438718aa37d6d3d1b82bffd3750985 (
plain)
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
|
cmake_minimum_required(VERSION 3.24)
project(chess)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
file(GLOB_RECURSE SOURCE_FILES src/*.cpp src/*.hpp)
add_executable(${PROJECT_NAME} ${SOURCE_FILES})
target_include_directories(${PROJECT_NAME} PRIVATE src)
if (MSVC)
target_compile_options(${PROJECT_NAME} PRIVATE /W4 /WX)
else()
target_compile_options(${PROJECT_NAME} PRIVATE
-Wall
-Wextra
-Wpedantic
-Werror
-Wshadow
-Wconversion
-Wsign-conversion
-Wcast-align
-Wcast-qual
-Wformat=2
-Wnull-dereference
-Wdouble-promotion
-Wimplicit-fallthrough
-Wmissing-declarations
-Wredundant-decls
-Wundef
-Wwrite-strings
-Wold-style-cast # C++ only
-Woverloaded-virtual # C++ only
-Wnon-virtual-dtor # C++ only
-Wduplicated-cond # GCC
-Wduplicated-branches # GCC
-Wlogical-op # GCC
-Wuseless-cast # C++ only
-Wextra-semi # Clang
)
endif()
if (NOT MSVC AND CMAKE_BUILD_TYPE STREQUAL "Debug")
target_compile_options(${PROJECT_NAME} PRIVATE
-fsanitize=address,undefined
-fno-omit-frame-pointer
)
target_link_options(${PROJECT_NAME} PRIVATE
-fsanitize=address,undefined
)
endif()
|