forked from d99kris/rapidcsv
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
115 lines (107 loc) · 3.08 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
113
114
# Project
cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
project(rapidcsv VERSION 1.0 LANGUAGES CXX)
set (CMAKE_CXX_STANDARD 11)
if(MSVC)
if(CMAKE_CXX_FLAGS MATCHES "/W[0-4]")
string(REGEX REPLACE "/W[0-4]" "/W4" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4")
endif()
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -Wall -Wextra -Wpedantic -Wshadow -Wpointer-arith \
-Wcast-qual -Wno-missing-braces -Wswitch-default -Wcast-align -Wunreachable-code \
-Wundef -Wuninitialized")
endif()
include(CheckIncludeFileCXX)
check_include_file_cxx(codecvt HAS_CODECVT)
if(HAS_CODECVT)
add_definitions(-DHAS_CODECVT)
endif()
# Test init
include(CTest)
enable_testing()
include_directories("src")
set(LIB_HEADERS "src/rapidcsv.h")
set(TEST_HEADERS "tests/unittest.h")
# Test macro add_perf_test
macro (add_perf_test testname)
add_executable(${testname} tests/${testname}.cpp)
add_test(NAME ${testname} CONFIGURATIONS perf Release COMMAND "${PROJECT_BINARY_DIR}/${testname}")
endmacro (add_perf_test)
# Test macro add_unit_test
macro (add_unit_test testname)
add_executable(${testname} tests/${testname}.cpp)
add_test(NAME ${testname} CONFIGURATIONS unit Debug COMMAND "${PROJECT_BINARY_DIR}/${testname}")
endmacro (add_unit_test)
# Unit tests
if(1)
add_unit_test(test001)
add_unit_test(test002)
add_unit_test(test003)
add_unit_test(test004)
add_unit_test(test005)
add_unit_test(test006)
add_unit_test(test007)
add_unit_test(test008)
add_unit_test(test009)
add_unit_test(test010)
add_unit_test(test011)
add_unit_test(test012)
add_unit_test(test013)
add_unit_test(test014)
add_unit_test(test015)
add_unit_test(test016)
add_unit_test(test017)
add_unit_test(test018)
add_unit_test(test019)
add_unit_test(test020)
add_unit_test(test021)
add_unit_test(test022)
add_unit_test(test023)
add_unit_test(test024)
add_unit_test(test025)
add_unit_test(test026)
add_unit_test(test027)
add_unit_test(test028)
add_unit_test(test029)
add_unit_test(test030)
add_unit_test(test031)
add_unit_test(test032)
add_unit_test(test033)
add_unit_test(test034)
add_unit_test(test035)
add_unit_test(test036)
add_unit_test(test037)
add_unit_test(test038)
add_unit_test(test039)
add_executable(test040 tests/test040.cpp tests/test040b.cpp)
add_test(NAME text040 CONFIGURATIONS unit COMMAND "${PROJECT_BINARY_DIR}/test040")
add_unit_test(test041)
add_unit_test(test042)
add_unit_test(test043)
add_unit_test(test044)
add_unit_test(test045)
add_unit_test(test046)
add_unit_test(test047)
add_unit_test(test048)
add_unit_test(test049)
add_unit_test(test050)
add_unit_test(test051)
add_unit_test(test052)
add_unit_test(test053)
add_unit_test(test054)
add_unit_test(test055)
add_unit_test(test056)
if (HAS_CODECVT)
add_unit_test(test057)
add_unit_test(test058)
add_unit_test(test059)
add_unit_test(test060)
endif()
endif()
# perf tests
add_perf_test(ptest001)
add_perf_test(ptest002)
# Examples
add_executable(example001 examples/example001.cpp)