-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
72 lines (54 loc) · 1.43 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
cmake_minimum_required(VERSION 3.14)
include(cmake/prelude.cmake)
project(
cloxc
VERSION 0.1.0
DESCRIPTION "Lox C implementation"
LANGUAGES C
)
include(cmake/project-is-top-level.cmake)
include(cmake/variables.cmake)
# ---- Declare library ----
add_library(
cloxc_lib OBJECT
source/table.c
source/object.c
source/scanner.c
source/compiler.c
source/vm.c
source/value.c
source/chunk.c
source/memory.c
source/debug.c
source/lib.c
)
target_include_directories(
cloxc_lib ${warning_guard}
PUBLIC
"$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/source>"
)
target_compile_features(cloxc_lib PUBLIC c_std_11)
# ---- Declare executable ----
add_executable(cloxc_exe source/main.c)
add_executable(cloxc::exe ALIAS cloxc_exe)
set_property(TARGET cloxc_exe PROPERTY OUTPUT_NAME cloxc)
target_compile_features(cloxc_exe PRIVATE c_std_11)
target_link_libraries(cloxc_exe PRIVATE cloxc_lib)
# ---- Install rules ----
if(NOT CMAKE_SKIP_INSTALL_RULES)
include(cmake/install-rules.cmake)
endif()
# ---- Developer mode ----
if(NOT cloxc_DEVELOPER_MODE)
return()
elseif(NOT PROJECT_IS_TOP_LEVEL)
message(
AUTHOR_WARNING
"Developer mode is intended for developers of cloxc"
)
endif()
include(cmake/dev-mode.cmake)
if(CMAKE_C_COMPILER_ID MATCHES "Clang")
target_compile_options(cloxc_lib PRIVATE -Wno-float-equal)
target_compile_options(cloxc_exe PRIVATE -Wno-float-equal)
endif()