-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
59 lines (50 loc) · 1.53 KB
/
CMakeLists.txt
File metadata and controls
59 lines (50 loc) · 1.53 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
cmake_minimum_required(VERSION 3.10)
project(chip8-cpp)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
set(CMAKE_CXX_EXTENSIONS FALSE)
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)
set(SOURCES main.cpp chip8.cpp)
add_executable(chip8 ${SOURCES})
# https://github.com/cpp-best-practices/cppbestpractices/blob/master/02-Use_the_Tools_Available.md#gcc--clang
target_compile_options(chip8 PUBLIC
-Wall -Wextra -pedantic -Wshadow
-Wnon-virtual-dtor
-Wold-style-cast
-Wcast-align
-Wunused
-Woverloaded-virtual
# -Wconversion
# -Wsign-conversion
-Wmisleading-indentation
-Wduplicated-cond
-Wduplicated-branches
-Wlogical-op
-Wnull-dereference
-Wuseless-cast
-Wdouble-promotion
-Wformat=2
# -Wlifetime
-Wimplicit-fallthrough
)
target_compile_options(chip8 PUBLIC "$<$<CONFIG:Debug>:-g>")
target_compile_options(chip8 PUBLIC "$<$<CONFIG:Release>:-O3;-s>")
find_program(CPPCHECK cppcheck)
if(CPPCHECK)
set(CMAKE_CXX_CPPCHECK ${CPPCHECK} --enable=all --suppress=missingInclude --suppress=unusedFunction)
else()
message(AUTHOR_WARNING "cppcheck not found")
endif()
# find_program(CLANG_TIDY clang-tidy)
# if(CLANG_TIDY)
# set(CMAKE_CXX_CLANG_TIDY ${CLANG_TIDY})
# else()
# message(AUTHOR_WARNING "clang-tidy not found")
# endif()
install(TARGETS chip8
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
find_package(SDL2 REQUIRED)
include_directories(${SDL2_INCLUDE_DIRS})
target_link_libraries(chip8 ${SDL2_LIBRARIES})