-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathCMakeLists.txt
107 lines (85 loc) · 2.86 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
cmake_minimum_required (VERSION 2.6)
project (roxml C)
set (VERSION "2")
set (SOVERSION "3.0.2")
option(CONFIG_XML_FILE "Can the target library parse file documents. When set to OFF, this result in smaller binary." ON)
option(CONFIG_XML_EDIT "Can the target library modify XML tree. When set to OFF, this result in smaller binary (this saves about 3kb)" ON)
option(CONFIG_XML_COMMIT "Can the target library commit a tree. When set to OFF, this result in smaller binary (this saves about 5kb)." ON)
option(CONFIG_XML_XPATH "Can the target library perform xpath queries. When set to 0, this result in smaller binary (this saves about 20kb)." ON)
# Enable UnitTest and CDash support
# This also adds the option BUILD_TESTING
include(CTest)
if (BUILD_TESTING)
add_subdirectory(unittest)
endif()
if ("${CMAKE_SYSTEM_NAME}" MATCHES "Linux")
add_definitions(-DLINUX)
endif()
include_directories(src)
add_definitions (-DIGNORE_EMPTY_TEXT_NODES -DCONFIG_XML_CONTENT -DCONFIG_XML_NAV -DCONFIG_XML_BUFF)
set(ROXML_SOURCES
src/roxml_core.c
src/roxml_parser.c
src/roxml_buff.c
src/roxml_nav.c
src/roxml_content.c
src/roxml_mem.c
src/roxml_stub.c
)
set(ROXML_HEADERS
src/roxml.h
src/roxml_buff.h
src/roxml_core.h
src/roxml_defines.h
src/roxml_internal.h
src/roxml_mem.h
src/roxml_parser.h
src/roxml_tune.h
src/roxml_types.h
src/roxml_xpath.h
)
if (CONFIG_XML_FILE)
add_definitions(-DCONFIG_XML_FILE)
set(ROXML_SOURCES ${ROXML_SOURCES} src/roxml_file.c)
set(ROXML_HEADERS ${ROXML_HEADERS} src/roxml_file.h)
endif()
if (CONFIG_XML_EDIT)
add_definitions(-DCONFIG_XML_EDIT)
set(ROXML_SOURCES ${ROXML_SOURCES} src/roxml_edit.c)
endif()
if (CONFIG_XML_COMMIT)
add_definitions(-DCONFIG_XML_COMMIT)
set(ROXML_SOURCES ${ROXML_SOURCES} src/roxml_commit.c)
endif()
if (CONFIG_XML_XPATH)
add_definitions(-DCONFIG_XML_XPATH)
set(ROXML_SOURCES ${ROXML_SOURCES} src/roxml_xpath.c)
set(ROXML_HEADERS ${ROXML_HEADERS} src/roxml_xpath.h)
endif()
if (${CMAKE_SYSTEM_NAME} MATCHES "Windows")
set(ROXML_HEADERS ${ROXML_HEADERS} src/roxml_win32_native.h)
endif()
# Note: we need to add the headers to create Visual Studio Projects
# with working intellisense. For building the project this would not be
# necessary
add_library(roxml-dynamic SHARED ${ROXML_SOURCES} ${ROXML_HEADERS})
add_library(roxml-static STATIC ${ROXML_SOURCES} ${ROXML_HEADERS})
add_executable(roxml-tool src/roxml_shell.c)
target_link_libraries(roxml-tool roxml-dynamic)
set_target_properties (roxml-dynamic
PROPERTIES
OUTPUT_NAME roxml
SOVERSION ${SOVERSION}
VERSION ${VERSION}
)
set_target_properties (roxml-static
PROPERTIES
OUTPUT_NAME roxml
)
set_target_properties (roxml-tool
PROPERTIES
OUTPUT_NAME roxml
)
install (TARGETS roxml-dynamic roxml-static DESTINATION lib)
install (TARGETS roxml-tool DESTINATION bin)
install (FILES "src/roxml.h" DESTINATION include)