-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathCMakeLists.txt
91 lines (76 loc) · 2.67 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
81
82
83
84
85
86
87
88
89
90
91
cmake_minimum_required(VERSION 3.10..3.15)
if(${CMAKE_VERSION} VERSION_LESS 3.12)
cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION})
endif()
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.9" CACHE STRING "Minimum OS X deployment version")
project(NAGI
VERSION "2.0.7"
DESCRIPTION "New Adventure Game Interpreter"
LANGUAGES C
)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/CMake")
# Tools like ninja don't have a pseudo-terminal so compilers assume no coloured output
option (AGS_FORCE_COLOURED_OUTPUT "Always produce ANSI-coloured output (GNU/Clang only)." OFF)
if (${AGS_FORCE_COLOURED_OUTPUT})
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
add_compile_options (-fdiagnostics-color=always)
elseif ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
add_compile_options (-fcolor-diagnostics)
endif ()
endif ()
# Interprocedural optimisation
include(CheckIPOSupported)
check_ipo_supported(RESULT ipo_supported OUTPUT ipo_not_supported_reason)
if(ipo_supported)
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION_RELEASE TRUE)
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION_RELWITHDEBINFO TRUE)
else()
message(STATUS "Interprocedural optimisation (IPO/LTO) not supported: <${ipo_not_supported_reason}>")
endif()
if(MSVC)
add_compile_options(/MP) # Build with Multiple Processes
add_compile_definitions(_CRT_SECURE_NO_DEPRECATE)
add_compile_definitions(_CRT_NONSTDC_NO_DEPRECATE)
else()
add_compile_options(
-fsigned-char
-fno-strict-aliasing
-fwrapv
-Wall
-Wextra
-Wcast-align
-Wcast-qual
-Wconditional-uninitialized
-Wendif-labels
-Wfloat-equal
-Wformat
-Wformat-security
-Winit-self
-Winline
-Wmissing-noreturn
-Wmissing-declarations
-Wmissing-variable-declarations
-Wpointer-arith
-Wshadow
-Wundef
-Wunreachable-code
-Wunreachable-code-break
-Wunreachable-code-return
-Wunused-result
-Wwrite-strings
# -Weverything
# -Wno-padded
# -Wno-conversion
# -Wno-format-pedantic
-Werror=write-strings
-Werror=implicit-function-declaration
-Werror=unused-result
)
add_compile_options($<$<COMPILE_LANGUAGE:C>:-Wbad-function-cast>)
add_compile_options($<$<COMPILE_LANGUAGE:C>:-Wdeclaration-after-statement>)
add_compile_options($<$<COMPILE_LANGUAGE:C>:-Wno-missing-prototypes>)
add_compile_options($<$<COMPILE_LANGUAGE:C>:-Wold-style-definition>)
add_compile_options($<$<COMPILE_LANGUAGE:C>:-Wstrict-prototypes>)
endif()
include(AddSDL2)
add_subdirectory(src)