-
Notifications
You must be signed in to change notification settings - Fork 37
/
CMakeLists.txt
78 lines (63 loc) · 3 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
cmake_minimum_required(VERSION 3.16)
project(config-loader)
set(CMAKE_CXX_STANDARD 17)
message(CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE})
option(${PROJECT_NAME}_BUILD_TESTS OFF)
set(BUILD_TESTS ${PROJECT_NAME}_BUILD_TESTS)
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
set (BUILD_TESTS ON)
endif()
option(${PROJECT_NAME}_ASAN OFF)
set(USE_ASAN ${PROJECT_NAME}_ASAN)
if (${USE_ASAN} AND (NOT CMAKE_CXX_COMPILER_ID STREQUAL "MSVC"))
set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fno-omit-frame-pointer -fsanitize=address")
set (CMAKE_LINKER_FLAGS_DEBUG "${CMAKE_LINKER_FLAGS_DEBUG} -fno-omit-frame-pointer -fsanitize=address")
endif()
###############################################################################
# thirdparty option
option(HAS_TINYXML2 "enable tinyxml2" ON)
option(HAS_JSONCPP "enable jsoncpp" ON)
option(HAS_YAMLCPP "enable yamlcpp" ON)
message(STATUS "enable tinyxml2: ${HAS_TINYXML2}")
message(STATUS "enable jsoncpp: ${HAS_JSONCPP}")
message(STATUS "enable yamlcpp: ${HAS_YAMLCPP}")
###############################################################################
set(CONFIG_LOADER_INC
include/config-loader/utils/RepeatMacro.h
include/config-loader/core/DefineSchema.h
include/config-loader/core/ReflectedTraits.h
include/config-loader/ConfigLoaderNS.h
include/config-loader/core/ForEachField.h
include/config-loader/ConfigLoader.h
include/config-loader/Result.h
include/config-loader/deserialize/DeserializeTraitsDecl.h
include/config-loader/deserialize/DeserializeTraits.h
include/config-loader/deserialize/CompoundDeserializeTraits.h
include/config-loader/deserialize/PrimitiveDeserializeTraits.h
include/config-loader/deserialize/Deserializer.h
include/config-loader/utils/Log.h
include/config-loader/utils/Assertion.h
include/config-loader/parsers/TinyXML2Parser.h
include/config-loader/parsers/JsonCppParser.h
include/config-loader/parsers/YamlCppParser.h
include/config-loader/parsers/UnsupportedParser.h
include/config-loader/serialize/Serializer.h
include/config-loader/serialize/SerializeTraits.h
include/config-loader/serialize/SerializeTraitsDecl.h
include/config-loader/utils/CommonTraits.h
include/config-loader/serialize/PrimitiveSerializeTraits.h
include/config-loader/serialize/CompoundSerializeTraits.h
include/config-loader/serialize/TypeSerializer.h
include/config-loader/utils/ConstexprStringUtils.h)
add_library(${PROJECT_NAME} STATIC
${CONFIG_LOADER_INC}
src/utils/GetFileContent.cpp)
include(third-party/ThirdParty.cmake)
target_include_directories(${PROJECT_NAME}
PUBLIC ${PROJECT_SOURCE_DIR}/include)
target_link_libraries(${PROJECT_NAME} PUBLIC ${THIRD_PARTY_LIBRARIES})
install(TARGETS ${PROJECT_NAME} DESTINATION lib)
install(DIRECTORY include/config-loader DESTINATION include)
if (${BUILD_TESTS})
add_subdirectory(test/ut)
endif()