-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
69 lines (54 loc) · 1.78 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
cmake_minimum_required(VERSION 3.22)
project(chadinterpreter VERSION 1.0.0 LANGUAGES C)
set(CMAKE_C_STANDARD 99)
set(CMAKE_C_STANDARD_REQUIRED TRUE)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
include(GNUInstallDirs)
set(default_build_type "Debug")
if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message(STATUS "Setting build type to '${default_build_type}' as none was specified.")
set(CMAKE_BUILD_TYPE "${default_build_type}" CACHE
STRING "Choose the type of build." FORCE)
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
"Debug" "Release" "MinSizeRel" "RelWithDebInfo")
endif ()
include(CheckSymbolExists)
add_library(chadinterpreter
src/ast.c
src/ast.h
src/stb_ds.h
src/stb_extra.h
src/interpreter.c
src/interpreter.h
src/lexer.c
src/lexer.h
src/mem.h
src/parser.c
src/parser.h
src/runtime_types.h
src/tokens.h
src/binary_ops.h
src/unary_ops.h
src/gc.h
src/builtins.h
src/builtins.c
src/getopt_impl.h
src/getline_impl.h
src/errors.h
)
add_executable(chadeval src/eval.c)
target_compile_definitions(chadeval PRIVATE APP_VERSION="${PROJECT_VERSION}" APP_NAME="${PROJECT_NAME}")
check_symbol_exists(getopt "unistd.h" HAVE_GETOPT)
check_symbol_exists(getline "stdio.h" HAVE_GETLINE)
if (HAVE_GETLINE)
target_compile_definitions(chadinterpreter PRIVATE HAVE_GETLINE)
endif ()
if (HAVE_GETOPT)
target_compile_definitions(chadeval PRIVATE HAVE_GETOPT)
endif ()
target_link_libraries(chadeval PRIVATE chadinterpreter)
if (UNIX)
target_compile_options(chadinterpreter PRIVATE "-Wall")
target_compile_options(chadeval PRIVATE "-Wall")
endif ()
install(TARGETS chadinterpreter chadeval)