-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
56 lines (49 loc) · 1.27 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
cmake_minimum_required(VERSION 3.0)
project(tinc)
add_compile_options(-Wall -Wextra -Wpedantic -Werror -pedantic-errors)
include_directories(${PROJECT_SOURCE_DIR})
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_COLOR_DIAGNOSTICS ON)
set(SRCS
src/ast.c
src/compiler.c
src/lexer.c
src/parser.c
src/preprocessor.c
src/scanner.c
src/string.c
src/token.c
src/vector.c)
set(MAIN_SRCS
src/main.c ${SRCS})
set(TEST_SRCS
test/ast.c
test/hash.c
test/main.c
test/preprocessor.c
test/string.c
test/vector.c
${SRCS})
add_executable(tinc ${MAIN_SRCS})
set_property(TARGET tinc PROPERTY C_STANDARD_REQUIRED ON)
set_property(TARGET tinc PROPERTY C_STANDARD 90)
# Tests
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
include(ExternalProject)
ExternalProject_Add(
ctest
GIT_REPOSITORY https://github.com/bvdberg/ctest
PREFIX ctest
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
UPDATE_DISCONNECTED TRUE
)
ExternalProject_Get_property(ctest SOURCE_DIR)
list(APPEND CMAKE_CTEST_ARGUMENTS "--verbose")
# Add tests
enable_testing()
add_executable(tinc_tests ${TEST_SRCS})
include_directories(${SOURCE_DIR})
add_test(test tinc_tests)
endif()