-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
70 lines (52 loc) · 1.35 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.28)
include(FetchContent)
set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
project(Lev)
find_package(LLVM 18.1 REQUIRED CONFIG)
add_definitions(${LLVM_DEFINITIONS})
llvm_map_components_to_libnames(llvm_libs support core irreader)
add_executable(lev lev/driver.cpp)
target_compile_options(lev
PUBLIC
# -Wall
# -Wextra
# -Wpedantic
-fno-rtti
-fno-exceptions
)
add_library(liblev
STATIC
lev/lex/lex.cpp
lev/lex/token_buffer.cpp
lev/lex/token_kind.cpp
lev/parse/parse.cpp
lev/compilation_unit.cpp
lev/diagnostics_consumer.cpp
lev/source/source_metadata.cpp
)
target_include_directories(liblev PUBLIC "." ${LLVM_INCLUDE_DIRS})
target_link_libraries(lev liblev ${llvm_libs})
FetchContent_Declare(
googletest
URL https://github.com/google/googletest/archive/03597a01ee50ed33e9dfd640b249b4be3799d395.zip
)
# For Windows: Prevent overriding the parent project's compiler/linker settings
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
FetchContent_MakeAvailable(googletest)
enable_testing()
add_executable(test_runner lev/test_runner.cpp)
target_sources(
test_runner
PRIVATE
lev/source/source_metadata_test.cpp
lev/lex/lex_test.cpp
)
target_link_libraries(
test_runner
liblev
GTest::gtest_main
${llvm_libs}
)
include(GoogleTest)