-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
60 lines (49 loc) · 1.55 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
cmake_minimum_required(VERSION 3.0)
cmake_policy(SET CMP0048 NEW)
project(
xmlrw
VERSION 0.1.0
LANGUAGES CXX
)
set(CPACK_PACKAGE_VERSION_MAJOR ${PROJECT_VERSION_MAJOR})
set(CPACK_PACKAGE_VERSION_MINOR ${PROJECT_VERSION_MINOR})
set(CPACK_PACKAGE_VERSION_PATCH ${PROJECT_VERSION_PATCH})
set(CPACK_SOURCE_PACKAGE_FILE_NAME "${PROJECT_NAME}-${PROJECT_VERSION}")
set(CPACK_SOURCE_IGNORE_FILES "/\\\\.git/" "\\\\.#" "/#" ".*~$")
include(CPack)
set(CMAKE_CXX_STANDARD 11)
option(BUILD_USE_STATIC_RUNTIME "Use the static runtime library on Windows"
OFF)
if(WIN32)
set(BUILD_WITH_XMLLITE_DEFAULT ON)
else()
set(BUILD_WITH_XMLLITE_DEFAULT OFF)
endif()
option(BUILD_WITH_XMLLITE "Use XmlLite (Windows XP SP2+)"
${BUILD_WITH_XMLLITE_DEFAULT})
if(NOT BUILD_WITH_XMLLITE)
set(REQUIRE_LIBXML2 REQUIRED)
endif()
find_package(LibXml2 ${REQUIRE_LIBXML2})
find_package(Doxygen)
find_package(Perl)
if(MSVC AND BUILD_USE_STATIC_RUNTIME)
foreach (CONFIG DEBUG RELEASE MINSIZEREL RELWITHDEBINFO)
string(REPLACE "/MD" "/MT" CMAKE_CXX_FLAGS_${CONFIG} "${CMAKE_CXX_FLAGS_${CONFIG}}")
endforeach()
endif()
if(MSVC)
foreach(CONFIG DEBUG RELWITHDEBINFO)
string(REPLACE "/Zi" "/Z7" CMAKE_CXX_FLAGS_${CONFIG} "${CMAKE_CXX_FLAGS_${CONFIG}}")
endforeach()
endif()
if(WIN32)
set(XMLRW_WIN32_WINNT 0x500 CACHE STRING "Minimum supported Windows version")
add_definitions(
-D _WIN32_WINNT=${XMLRW_WIN32_WINNT}
-D _UNICODE
-D NOMINMAX
)
endif()
add_subdirectory(src)
configure_file(Doxyfile.in Doxyfile @ONLY)