-
Notifications
You must be signed in to change notification settings - Fork 43
/
Copy pathCMakeLists.txt
74 lines (57 loc) · 1.81 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
cmake_minimum_required(VERSION 3.23)
project(RED4ext LANGUAGES CXX)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
include(ConfigureVersionFromGit)
include(ConfigureDefaultOutputDirectories)
include(TargetOutputDirectory)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
configure_version_from_git()
configure_default_output_directories()
add_compile_definitions(
# Support Windows 7 and above.
WINVER=0x0601
_WIN32_WINNT=0x0601
# Exclude unnecessary APIs.
WIN32_LEAN_AND_MEAN
# Use Unicode charset.
UNICODE
_UNICODE
)
add_compile_options(
# Enable correct reporting of C++ version, see https://docs.microsoft.com/en-us/cpp/build/reference/zc-cplusplus.
$<$<BOOL:MSVC>:/Zc:__cplusplus>
# Mark all dependencies headers as external.
$<$<BOOL:MSVC>:/external:I${PROJECT_SOURCE_DIR}/deps>
# Set the default warning level for external includes.
$<$<BOOL:MSVC>:/external:W0>
# Allow warnings if some template code is used in our code base.
$<$<BOOL:MSVC>:/external:templates->
)
include(ConfigureAndIncludeDetours)
include(ConfigureAndIncludeFmt)
include(ConfigureAndIncludeRED4extSdk)
include(ConfigureAndIncludeSimdjson)
include(ConfigureAndIncludeSpdlog)
include(ConfigureAndIncludeToml11)
include(ConfigureAndIncludeTslOrderedMap)
include(ConfigureAndIncludeWil)
include(ConfigureAndIncludeRedscript)
option(RED4EXT_EXTRA_WARNINGS "Enable extra warnings." ON)
if(RED4EXT_EXTRA_WARNINGS)
if(MSVC)
add_compile_options(/W4)
else()
add_compile_options(-Wall -Wextra)
endif()
endif()
option(RED4EXT_TREAT_WARNINGS_AS_ERRORS "Treat compiler warnings as errors." OFF)
if(RED4EXT_TREAT_WARNINGS_AS_ERRORS)
if(MSVC)
add_compile_options(/WX)
else()
add_compile_options(-Werror)
endif()
endif()
add_subdirectory(src)