-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
56 lines (47 loc) · 2.23 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
##======---------------------------------------------------------------======##
# #
# Copyright 2021 Evan Cox <[email protected]> #
# #
# Use of this source code is governed by a BSD-style license that can be #
# found in the LICENSE.txt file at the root of this project, or at the #
# following link: https://opensource.org/licenses/BSD-3-Clause #
# #
##======---------------------------------------------------------------======##
cmake_minimum_required(VERSION 3.17)
project(gallium)
set(CMAKE_CXX_STANDARD 17) # need to affect libraries as well, not just gallium
option(GALLIUM_DEV "whether or not to build with `-Werror` or the compiler's equivalent" OFF)
function(gallium_configure_target TARGET SHOULD_SANITIZE)
list(APPEND GALLIUM_WARNINGS)
# enable warnings and warnings-as-errors in development
# there's no reason not to, and its off by default for normal use
if (GALLIUM_DEV)
if (${MSVC})
target_compile_options(${TARGET} PRIVATE /W3)
else ()
target_compile_options(${TARGET} PRIVATE
-Wall
-Wextra
-Wcast-qual
-Wconversion-null
-Wmissing-declarations
-Woverlength-strings
-Wpointer-arith
-Wunused-local-typedefs
-Wunused-result
-Wvarargs
-Wvla
-Wwrite-strings
-Werror
-ftemplate-backtrace-limit=20)
if (SHOULD_SANITIZE)
target_compile_options(${TARGET} PRIVATE -fsanitize=undefined,address)
target_link_options(${TARGET} PRIVATE -fsanitize=undefined,address)
endif ()
endif ()
message(STATUS "adding ${GALLIUM_WARNINGS} to ${TARGET}")
endif ()
target_compile_features(${TARGET} PUBLIC cxx_std_17)
endfunction()
add_subdirectory(compiler)
add_subdirectory(runtime)