-
Notifications
You must be signed in to change notification settings - Fork 132
/
CMakeLists.txt
112 lines (93 loc) · 3.83 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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
cmake_minimum_required(VERSION 3.0)
project(BigInt)
if(ENABLE_COVERAGE)
set(CMAKE_BUILD_TYPE Coverage)
else()
set(CMAKE_BUILD_TYPE Debug)
endif()
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin)
include_directories(include)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_FLAGS "-g -O0 -Wall -Wextra -pedantic-errors")
# Test runner
add_library(TestRunner STATIC
test/test_runner.cpp)
# Constructors:
add_executable(ConstructorsTest
test/constructors/constructors.cpp)
target_link_libraries(ConstructorsTest TestRunner)
# Functions:
add_executable(FunctionsConversionTest
test/functions/conversion.cpp)
target_link_libraries(FunctionsConversionTest TestRunner)
add_executable(FunctionsMathTest
test/functions/math.cpp)
target_link_libraries(FunctionsMathTest TestRunner)
add_executable(FunctionsRandomTest
test/functions/random.cpp)
target_link_libraries(FunctionsRandomTest TestRunner)
# Operators:
add_executable(OperatorsArithmeticAssignmentTest
test/operators/arithmetic_assignment.cpp)
target_link_libraries(OperatorsArithmeticAssignmentTest TestRunner)
add_executable(OperatorsAssignmentTest
test/operators/assignment.cpp)
target_link_libraries(OperatorsAssignmentTest TestRunner)
add_executable(OperatorsBinaryArithmeticTest
test/operators/binary_arithmetic.cpp)
target_link_libraries(OperatorsBinaryArithmeticTest TestRunner)
add_executable(OperatorsIncrementDecrementTest
test/operators/increment_decrement.cpp)
target_link_libraries(OperatorsIncrementDecrementTest TestRunner)
add_executable(OperatorsIOStreamTest
test/operators/io_stream.cpp)
target_link_libraries(OperatorsIOStreamTest TestRunner)
add_executable(OperatorsRelationalTest
test/operators/relational.cpp)
target_link_libraries(OperatorsRelationalTest TestRunner)
add_executable(OperatorsUnaryArithmeticTest
test/operators/unary_arithmetic.cpp)
target_link_libraries(OperatorsUnaryArithmeticTest TestRunner)
if(ENABLE_COVERAGE)
# Include code coverage module
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/CMake")
find_package(codecov)
add_coverage(ConstructorsTest)
add_coverage(FunctionsConversionTest)
add_coverage(FunctionsMathTest)
add_coverage(FunctionsRandomTest)
add_coverage(OperatorsArithmeticAssignmentTest)
add_coverage(OperatorsAssignmentTest)
add_coverage(OperatorsBinaryArithmeticTest)
add_coverage(OperatorsIncrementDecrementTest)
add_coverage(OperatorsIOStreamTest)
add_coverage(OperatorsRelationalTest)
add_coverage(OperatorsUnaryArithmeticTest)
list(APPEND LCOV_REMOVE_PATTERNS "'/usr/*'" "'include/third_party/*'")
coverage_evaluate()
endif()
include(CTest)
add_test(NAME ConstructorsTest
COMMAND $<TARGET_FILE:ConstructorsTest>)
add_test(NAME FunctionsConversionTest
COMMAND $<TARGET_FILE:FunctionsConversionTest>)
add_test(NAME FunctionsMathTest
COMMAND $<TARGET_FILE:FunctionsMathTest>)
add_test(NAME FunctionsRandomTest
COMMAND $<TARGET_FILE:FunctionsRandomTest>)
add_test(NAME OperatorsArithmeticAssignmentTest
COMMAND $<TARGET_FILE:OperatorsArithmeticAssignmentTest>)
add_test(NAME OperatorsAssignmentTest
COMMAND $<TARGET_FILE:OperatorsAssignmentTest>)
add_test(NAME OperatorsBinaryArithmeticTest
COMMAND $<TARGET_FILE:OperatorsBinaryArithmeticTest>)
add_test(NAME OperatorsIncrementDecrementTest
COMMAND $<TARGET_FILE:OperatorsIncrementDecrementTest>)
add_test(NAME OperatorsIOStreamTest
COMMAND $<TARGET_FILE:OperatorsIOStreamTest>)
add_test(NAME OperatorsRelationalTest
COMMAND $<TARGET_FILE:OperatorsRelationalTest>)
add_test(NAME OperatorsUnaryArithmeticTest
COMMAND $<TARGET_FILE:OperatorsUnaryArithmeticTest>)