-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
60 lines (46 loc) · 1.69 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
cmake_minimum_required(VERSION 3.10)
# Built using Clang 🐐
set(CMAKE_CXX_COMPILER_ID "Clang")
set(CMAKE_C_COMPILER_ID "Clang")
# Find the Clang compiler
find_program(CMAKE_CXX_COMPILER NAMES clang++ clang++-14 clang++-13 clang++-12 clang++-11 clang++-10 clang++-9 clang++-8 clang++-7 clang++-6.0 clang++)
find_program(CMAKE_C_COMPILER NAMES clang clang-14 clang-13 clang-12 clang-11 clang-10 clang-9 clang-8 clang-7 clang-6.0 clang)
# Double Check
if(NOT CMAKE_CXX_COMPILER)
message(FATAL_ERROR "Clang++ not found")
endif()
if(NOT CMAKE_C_COMPILER)
message(FATAL_ERROR "Clang not found")
endif()
project(RiftLang)
# C++20 required
set(CMAKE_CXX_STANDARD 20)
# Set Debug Mode
set(CMAKE_BUILD_TYPE Debug)
# add -DCMAKE_EXPORT_COMPILE_COMMANDS=ON to generate compile_commands.json
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
# sets targets
include(Options.mk)
include(FindReadline.mk)
# "#includes"
include_directories(${CMAKE_SOURCE_DIR}/include)
include_directories(${CMAKE_SOURCE_DIR}/external)
add_subdirectory(lib)
enable_testing()
add_subdirectory(tests)
# Google {Test&Mock}
add_subdirectory(external/googletest)
include_directories(${gtest_SOURCE_DIR}/include ${gtest_SOURCE_DIR})
include_directories(${gmock_SOURCE_DIR}/include ${gmock_SOURCE_DIR})
# Google {Abseil}
# add_compile_definitions(ABSL_USE_GOOGLE_DEFAULT_NAMESPACE)
# add_subdirectory(external/abseil)
# find_package(absl REQUIRED)
# include_directories(${abseil_SOURCE_DIR})
# target_link_libraries(riftlang absl::base absl::synchronization absl::strings)
#readline library for interpreter
# find_package(Readline REQUIRED)
# if READLINE_FOUND is false then fail
if(NOT READLINE_FOUND)
message(FATAL_ERROR "Readline not found")
endif()