forked from qicosmos/iguana
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
76 lines (64 loc) · 2.03 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 2.15)
project(iguana)
if(MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /std:c++20")
ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS)
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -pthread -g -std=c++20")
set(CMAKE_CXX_FLAGS_RELEASE "-O3")
endif(MSVC)
set(CMAKE_CXX_LINK_EXECUTABLE "${CMAKE_CXX_LINK_EXECUTABLE} -ldl")
set(IGUANA_DIR ${CMAKE_CURRENT_SOURCE_DIR})
add_definitions(-DTHROW_UNKNOWN_KEY)
option(HAS_RAPIDJSON "import rapidjson" OFF)
if (${HAS_RAPIDJSON})
add_definitions(-DHAS_RAPIDJSON)
include_directories(../rapidjson/include)
ADD_DEFINITIONS(-DRAPIDJSON_HAS_STDSTRING)
endif()
include_directories(
${IGUANA_DIR}
${IGUANA_DIR}/third_party/frozen/include
${IGUANA_DIR}/third_party/rapidxml
${IGUANA_DIR}/third_party/mscharconv/include
)
set(EXAMPLE
example/example.cpp
)
set(JSON_EXAMPLE
example/json_example.cpp
)
set(XML_EXAMPLE
example/xml_example.cpp
)
set(TEST_SOME test/test.cpp)
set(TEST_UT test/unit_test.cpp)
set(TEST_JSON_FILES test/test_json_files.cpp)
set(TEST_XML test/test_xml.cpp)
set(BENCHMARK benchmark/benchmark.cpp)
add_executable(example ${EXAMPLE})
add_executable(json_example ${JSON_EXAMPLE})
add_executable(xml_example ${XML_EXAMPLE})
add_executable(test_some ${TEST_SOME})
add_executable(test_ut ${TEST_UT})
add_executable(test_json_files ${TEST_JSON_FILES})
add_executable(test_xml ${TEST_XML})
add_executable(benchmark ${BENCHMARK})
# unit test
option(BUILD_UNIT_TESTS "Build unit tests" ON)
if (BUILD_UNIT_TESTS)
enable_testing()
endif ()
# coverage test
option(COVERAGE_TEST "Build with unit test coverage" OFF)
if(COVERAGE_TEST)
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage --coverage")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-instr-generate -fcoverage-mapping")
endif()
endif()
add_test(NAME test_some COMMAND test_some)
add_test(NAME test_ut COMMAND test_ut)
add_test(NAME test_json_files COMMAND test_json_files)
add_test(NAME test_xml COMMAND test_xml)