-
Notifications
You must be signed in to change notification settings - Fork 4
/
CMakeLists.txt
64 lines (51 loc) · 1.92 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
# set minimum version of CMake
# (this is compatible with all version of CMake but versions before 3.12 ignore
# the range and only use the first version)
cmake_minimum_required(VERSION 3.11...3.18)
# fallback to provide the same functionallity as in CMake 3.12+
if(${CMAKE_VERSION} VERSION_LESS 3.12)
cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION})
endif()
# project definition
project(MiniLua VERSION 1.0
DESCRIPTION "Value tracing lua interpreter"
LANGUAGES CXX C)
# global settings
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
add_compile_options(-Wall -Werror=return-type -fno-omit-frame-pointer)
# generates compile_commands.json that can be used by clang tooling
# (e.g. language server)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/")
# documentation
find_package(Doxygen)
find_package(Plantuml)
# dependencies
find_package(TreeSitterWrapper)
find_package(TreeSitterLua)
# include(CMakePrintHelpers)
# cmake_print_properties(TARGETS TreeSitterWrapper::TreeSitter TreeSitter TreeSitterWrapper PROPERTIES INTERFACE_INCLUDE_DIRECTORIES)
# library
add_subdirectory(src)
# tests
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
add_subdirectory(extern/catch2)
# support "*san" build types
find_package(Sanitizers)
# support "coverage" build type
include(CodeCoverage)
# remove tests and dependencies from coverage report
set(LCOV_REMOVE_EXTRA "'${CMAKE_SOURCE_DIR}/tests/*'" "'${CMAKE_BINARY_DIR}/*'")
string(TOUPPER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_UPPERCASE)
if(CMAKE_BUILD_TYPE_UPPERCASE STREQUAL COVERAGE)
set(COVERAGE ON)
endif()
add_subdirectory(bin)
add_subdirectory(tests)
add_subdirectory(bench)
# example applications
# (get compiled in ci but not run like tests)
add_subdirectory(examples)
endif()