-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
76 lines (59 loc) · 1.48 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
73
74
75
76
cmake_minimum_required(VERSION 3.10.2)
project(calculator)
include_directories(
lib/catch2/
lib/list/
lib/terminal_functions/
src/core/
src/ui/
src/__tests__/terminal_functions/
src/__tests__/list/
src/__tests__/random_tests/
)
file(GLOB CORE
"src/core/*.c"
"src/core/*.h"
"src/ui/*.h"
"src/ui/*.c"
)
file(GLOB LIBS
"lib/list/*.h"
"lib/list/*.c"
)
add_library(libs ${LIBS})
file(GLOB TEST_SOURCES
"src/__tests__/**/*.test.cpp"
"src/__tests__/main.test.cpp"
)
set_source_files_properties(
TEST_SOURCES_RANDOM_TESTS
PROPERTIES
LANGUAGE C
COMPILE_FLAGS "-Wall -ansi"
)
# set(GCC_COVERAGE_COMPILE_FLAGS "-Wall -ansi -std=c99")
# é o jeito que deu certo compilar código em C no padrão ANSI.
set(CMAKE_C_FLAGS "-Wall -g -ansi -std=c99")
# message(STATUS "random tests: ${TEST_SOURCES_RANDOM_TESTS}")
# add_library(includes ${INC_SOURCES} ${INC_HEADERS})
add_executable(calculator ${CORE} src/main/main.c)
target_link_libraries(calculator ${LIBS})
add_executable(
test_main ${LIBS} src/main/test_main.c
)
############################
## Executáveis dos testes ##
############################
add_executable(
test
${CORE}
${TEST_SOURCES}
${LIBS}
)
# Compilar os testes aletórios
# foreach(src_file ${TEST_SOURCES_RANDOM_TESTS})
# get_filename_component(executable ${src_file} NAME_WE)
# message(STATUS "exec ${executable}")
# add_executable(${executable} ${src_file} ${CORE})
# target_link_libraries(${executable} ${LIBS})
# endforeach(src_file TEST_SOURCES_RANDOM_TESTS)