-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
84 lines (62 loc) · 1.68 KB
/
Copy pathCMakeLists.txt
File metadata and controls
84 lines (62 loc) · 1.68 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
cmake_minimum_required(VERSION 3.25 FATAL_ERROR)
# project:
project(
core8
VERSION 0.1.0
DESCRIPTION "core8 is a CHIP8 emulator that offers a Qt GUI to run CHIP8 binaries"
HOMEPAGE_URL https://github.com/benvenutti/core8
LANGUAGES CXX
)
# modules:
include(CMakeDependentOption)
include(FetchContent)
# project options:
option(BUILD_TESTS "Build tests" ON)
cmake_dependent_option(CODE_COVERAGE "Enable code coverage" OFF "BUILD_TESTS" OFF)
# 3rd party dependencies:
find_package(Qt6 6.5 COMPONENTS Widgets REQUIRED)
if(BUILD_TESTS)
FetchContent_Declare(
Catch2
GIT_REPOSITORY https://github.com/catchorg/Catch2.git
GIT_TAG v3.0.1
)
FetchContent_MakeAvailable(Catch2)
endif()
# build settings:
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release FORCE)
endif()
# testing:
if(BUILD_TESTS)
enable_testing()
endif()
# compiler's warning messages:
if(MSVC)
add_compile_options(
# warnings:
/W4 /w14545 /w34242 /w34254 /w34287 /w44263 /w44265 /w44296 /w44311 /w44826
/we4289 /w14546 /w14547 /w14549 /w14555 /w14619 /w14905 /w14906 /w14928
# optimization levels:
$<$<CONFIG:RELEASE>:/O2>
$<$<CONFIG:DEBUG>:/Od>
)
else()
add_compile_options(
# warnings:
-Wall -Wconversion -Wsign-conversion -Wshadow -Wnon-virtual-dtor -Wcast-qual
-Wold-style-cast -Wcast-align -Wunused -Woverloaded-virtual -pedantic -Wextra
# optimization levels:
$<$<CONFIG:RELEASE>:-O3>
$<$<CONFIG:DEBUG>:-O0>
# coverage:
$<$<BOOL:${CODE_COVERAGE}>:-coverage>
)
add_link_options(
# coverage:
$<$<BOOL:${CODE_COVERAGE}>:-coverage>
)
endif()
# subdirectories:
add_subdirectory(model)
add_subdirectory(app-qtwidget)