annotate dep/pugixml/CMakeLists.txt @ 118:39521c47c7a3

*: another huge megacommit, SORRY The torrents page works a lot better now Added the edit option to the anime list right click menu Vectorized currently playing files Available player and extensions are now loaded at runtime from files in (dotpath)/players.json and (dotpath)/extensions.json These paths are not permanent and will likely be moved to (dotpath)/recognition ... ... ...
author Paper <mrpapersonic@gmail.com>
date Tue, 07 Nov 2023 23:40:54 -0500
parents d10b6c6b432e
children a45edd073f9e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
55
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
1 cmake_minimum_required(VERSION 3.4)
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
2 project(pugixml VERSION 1.13 LANGUAGES CXX)
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
3
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
4 include(CMakePackageConfigHelpers)
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
5 include(CMakeDependentOption)
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
6 include(GNUInstallDirs)
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
7 include(CTest)
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
8
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
9 cmake_dependent_option(PUGIXML_USE_VERSIONED_LIBDIR
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
10 "Use a private subdirectory to install the headers and libraries" OFF
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
11 "CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR" OFF)
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
12
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
13 cmake_dependent_option(PUGIXML_USE_POSTFIX
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
14 "Use separate postfix for each configuration to make sure you can install multiple build outputs" OFF
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
15 "CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR" OFF)
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
16
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
17 cmake_dependent_option(PUGIXML_STATIC_CRT
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
18 "Use static MSVC RT libraries" OFF
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
19 "MSVC" OFF)
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
20
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
21 cmake_dependent_option(PUGIXML_BUILD_TESTS
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
22 "Build pugixml tests" OFF
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
23 "BUILD_TESTING;CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR" OFF)
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
24
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
25 # Custom build defines
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
26 set(PUGIXML_BUILD_DEFINES CACHE STRING "Build defines for custom options")
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
27 separate_arguments(PUGIXML_BUILD_DEFINES)
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
28
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
29 # Technically not needed for this file. This is builtin CMAKE global variable.
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
30 option(BUILD_SHARED_LIBS "Build shared instead of static library" OFF)
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
31
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
32 # Expose option to build PUGIXML as static as well when the global BUILD_SHARED_LIBS variable is set
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
33 cmake_dependent_option(PUGIXML_BUILD_SHARED_AND_STATIC_LIBS
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
34 "Build both shared and static libraries" OFF
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
35 "BUILD_SHARED_LIBS" OFF)
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
36
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
37 # Expose options from the pugiconfig.hpp
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
38 option(PUGIXML_WCHAR_MODE "Enable wchar_t mode" OFF)
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
39 option(PUGIXML_COMPACT "Enable compact mode" OFF)
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
40
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
41 # Advanced options from pugiconfig.hpp
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
42 option(PUGIXML_NO_XPATH "Disable XPath" OFF)
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
43 option(PUGIXML_NO_STL "Disable STL" OFF)
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
44 option(PUGIXML_NO_EXCEPTIONS "Disable Exceptions" OFF)
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
45 mark_as_advanced(PUGIXML_NO_XPATH PUGIXML_NO_STL PUGIXML_NO_EXCEPTIONS)
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
46
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
47 # Policy configuration
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
48 if(POLICY CMP0091)
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
49 cmake_policy(SET CMP0091 NEW) # Enables use of MSVC_RUNTIME_LIBRARY
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
50 endif()
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
51
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
52 set(PUGIXML_PUBLIC_DEFINITIONS
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
53 $<$<BOOL:${PUGIXML_WCHAR_MODE}>:PUGIXML_WCHAR_MODE>
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
54 $<$<BOOL:${PUGIXML_COMPACT}>:PUGIXML_COMPACT>
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
55 $<$<BOOL:${PUGIXML_NO_XPATH}>:PUGIXML_NO_XPATH>
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
56 $<$<BOOL:${PUGIXML_NO_STL}>:PUGIXML_NO_STL>
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
57 $<$<BOOL:${PUGIXML_NO_EXCEPTIONS}>:PUGIXML_NO_EXCEPTIONS>)
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
58
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
59 # This is used to backport a CMake 3.15 feature, but is also forwards compatible
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
60 if (NOT DEFINED CMAKE_MSVC_RUNTIME_LIBRARY)
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
61 set(CMAKE_MSVC_RUNTIME_LIBRARY
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
62 MultiThreaded$<$<CONFIG:Debug>:Debug>$<$<NOT:$<BOOL:${PUGIXML_STATIC_CRT}>>:DLL>)
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
63 endif()
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
64
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
65 if (NOT DEFINED CMAKE_CXX_STANDARD_REQUIRED)
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
66 set(CMAKE_CXX_STANDARD_REQUIRED ON)
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
67 endif()
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
68
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
69 if (NOT DEFINED CMAKE_CXX_STANDARD)
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
70 set(CMAKE_CXX_STANDARD 11)
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
71 endif()
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
72
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
73 if (PUGIXML_USE_POSTFIX)
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
74 set(CMAKE_RELWITHDEBINFO_POSTFIX _r)
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
75 set(CMAKE_MINSIZEREL_POSTFIX _m)
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
76 set(CMAKE_DEBUG_POSTFIX _d)
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
77 endif()
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
78
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
79 if (CMAKE_VERSION VERSION_LESS 3.15)
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
80 set(msvc-rt $<TARGET_PROPERTY:MSVC_RUNTIME_LIBRARY>)
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
81
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
82 set(msvc-rt-mtd-shared $<STREQUAL:${msvc-rt},MultiThreadedDebugDLL>)
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
83 set(msvc-rt-mtd-static $<STREQUAL:${msvc-rt},MultiThreadedDebug>)
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
84 set(msvc-rt-mt-shared $<STREQUAL:${msvc-rt},MultiThreadedDLL>)
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
85 set(msvc-rt-mt-static $<STREQUAL:${msvc-rt},MultiThreaded>)
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
86 unset(msvc-rt)
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
87
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
88 set(msvc-rt-mtd-shared $<${msvc-rt-mtd-shared}:-MDd>)
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
89 set(msvc-rt-mtd-static $<${msvc-rt-mtd-static}:-MTd>)
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
90 set(msvc-rt-mt-shared $<${msvc-rt-mt-shared}:-MD>)
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
91 set(msvc-rt-mt-static $<${msvc-rt-mt-static}:-MT>)
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
92 endif()
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
93
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
94 set(versioned-dir $<$<BOOL:${PUGIXML_USE_VERSIONED_LIBDIR}>:/pugixml-${PROJECT_VERSION}>)
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
95
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
96 set(libs)
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
97
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
98 if (BUILD_SHARED_LIBS)
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
99 add_library(pugixml-shared SHARED
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
100 ${PROJECT_SOURCE_DIR}/scripts/pugixml_dll.rc
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
101 ${PROJECT_SOURCE_DIR}/src/pugixml.cpp)
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
102 add_library(pugixml::shared ALIAS pugixml-shared)
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
103 list(APPEND libs pugixml-shared)
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
104 string(CONCAT pugixml.msvc $<OR:
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
105 $<STREQUAL:${CMAKE_CXX_COMPILER_FRONTEND_VARIANT},MSVC>,
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
106 $<CXX_COMPILER_ID:MSVC>
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
107 >)
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
108
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
109 set_property(TARGET pugixml-shared PROPERTY EXPORT_NAME shared)
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
110 target_include_directories(pugixml-shared
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
111 PUBLIC
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
112 $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/src>)
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
113 target_compile_definitions(pugixml-shared
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
114 PUBLIC
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
115 ${PUGIXML_BUILD_DEFINES}
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
116 ${PUGIXML_PUBLIC_DEFINITIONS}
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
117 PRIVATE
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
118 PUGIXML_API=$<IF:${pugixml.msvc},__declspec\(dllexport\),__attribute__\(\(visibility\("default"\)\)\)>
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
119 )
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
120 target_compile_options(pugixml-shared
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
121 PRIVATE
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
122 ${msvc-rt-mtd-shared}
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
123 ${msvc-rt-mtd-static}
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
124 ${msvc-rt-mt-shared}
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
125 ${msvc-rt-mt-static})
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
126 endif()
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
127
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
128 if (NOT BUILD_SHARED_LIBS OR PUGIXML_BUILD_SHARED_AND_STATIC_LIBS)
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
129 add_library(pugixml-static STATIC
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
130 ${PROJECT_SOURCE_DIR}/src/pugixml.cpp)
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
131 add_library(pugixml::static ALIAS pugixml-static)
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
132 list(APPEND libs pugixml-static)
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
133
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
134 set_property(TARGET pugixml-static PROPERTY EXPORT_NAME static)
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
135 target_include_directories(pugixml-static
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
136 PUBLIC
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
137 $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/src>)
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
138 target_compile_definitions(pugixml-static
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
139 PUBLIC
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
140 ${PUGIXML_BUILD_DEFINES}
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
141 ${PUGIXML_PUBLIC_DEFINITIONS})
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
142 target_compile_options(pugixml-static
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
143 PRIVATE
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
144 ${msvc-rt-mtd-shared}
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
145 ${msvc-rt-mtd-static}
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
146 ${msvc-rt-mt-shared}
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
147 ${msvc-rt-mt-static})
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
148 endif()
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
149
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
150 if (BUILD_SHARED_LIBS)
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
151 set(pugixml-alias pugixml-shared)
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
152 else()
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
153 set(pugixml-alias pugixml-static)
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
154 endif()
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
155 add_library(pugixml INTERFACE)
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
156 target_link_libraries(pugixml INTERFACE ${pugixml-alias})
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
157 add_library(pugixml::pugixml ALIAS pugixml)
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
158
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
159 set_target_properties(${libs}
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
160 PROPERTIES
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
161 MSVC_RUNTIME_LIBRARY ${CMAKE_MSVC_RUNTIME_LIBRARY}
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
162 EXCLUDE_FROM_ALL ON
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
163 POSITION_INDEPENDENT_CODE ON
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
164 SOVERSION ${PROJECT_VERSION_MAJOR}
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
165 VERSION ${PROJECT_VERSION}
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
166 OUTPUT_NAME pugixml)
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
167
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
168 set_target_properties(${libs}
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
169 PROPERTIES
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
170 EXCLUDE_FROM_ALL OFF)
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
171 set(install-targets pugixml ${libs})
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
172
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
173 configure_package_config_file(
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
174 "${PROJECT_SOURCE_DIR}/scripts/pugixml-config.cmake.in"
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
175 "${PROJECT_BINARY_DIR}/pugixml-config.cmake"
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
176 INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
177 NO_CHECK_REQUIRED_COMPONENTS_MACRO
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
178 NO_SET_AND_CHECK_MACRO)
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
179
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
180 write_basic_package_version_file(
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
181 "${PROJECT_BINARY_DIR}/pugixml-config-version.cmake"
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
182 COMPATIBILITY SameMajorVersion)
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
183
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
184 if (PUGIXML_USE_POSTFIX)
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
185 if(CMAKE_BUILD_TYPE MATCHES RelWithDebInfo)
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
186 set(LIB_POSTFIX ${CMAKE_RELWITHDEBINFO_POSTFIX})
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
187 elseif(CMAKE_BUILD_TYPE MATCHES MinSizeRel)
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
188 set(LIB_POSTFIX ${CMAKE_MINSIZEREL_POSTFIX})
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
189 elseif(CMAKE_BUILD_TYPE MATCHES Debug)
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
190 set(LIB_POSTFIX ${CMAKE_DEBUG_POSTFIX})
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
191 endif()
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
192 endif()
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
193
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
194 configure_file(scripts/pugixml.pc.in pugixml.pc @ONLY)
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
195
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
196 if (NOT DEFINED PUGIXML_RUNTIME_COMPONENT)
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
197 set(PUGIXML_RUNTIME_COMPONENT Runtime)
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
198 endif()
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
199
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
200 if (NOT DEFINED PUGIXML_LIBRARY_COMPONENT)
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
201 set(PUGIXML_LIBRARY_COMPONENT Library)
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
202 endif()
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
203
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
204 if (NOT DEFINED PUGIXML_DEVELOPMENT_COMPONENT)
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
205 set(PUGIXML_DEVELOPMENT_COMPONENT Development)
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
206 endif()
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
207
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
208 set(namelink-component)
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
209 if (NOT CMAKE_VERSION VERSION_LESS 3.12)
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
210 set(namelink-component NAMELINK_COMPONENT ${PUGIXML_DEVELOPMENT_COMPONENT})
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
211 endif()
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
212 install(TARGETS ${install-targets}
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
213 EXPORT pugixml-targets
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
214 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT ${PUGIXML_RUNTIME_COMPONENT}
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
215 LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT ${PUGIXML_LIBRARY_COMPONENT} ${namelink-component}
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
216 ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT ${PUGIXML_DEVELOPMENT_COMPONENT}
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
217 INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}${versioned-dir})
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
218
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
219 install(EXPORT pugixml-targets
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
220 NAMESPACE pugixml::
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
221 DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/pugixml COMPONENT ${PUGIXML_DEVELOPMENT_COMPONENT})
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
222
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
223 export(EXPORT pugixml-targets
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
224 NAMESPACE pugixml::)
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
225
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
226 install(FILES
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
227 "${PROJECT_BINARY_DIR}/pugixml-config-version.cmake"
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
228 "${PROJECT_BINARY_DIR}/pugixml-config.cmake"
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
229 DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/pugixml COMPONENT ${PUGIXML_DEVELOPMENT_COMPONENT})
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
230
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
231 install(FILES ${PROJECT_BINARY_DIR}/pugixml.pc
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
232 DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig COMPONENT ${PUGIXML_DEVELOPMENT_COMPONENT})
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
233
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
234 install(
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
235 FILES
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
236 "${PROJECT_SOURCE_DIR}/src/pugiconfig.hpp"
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
237 "${PROJECT_SOURCE_DIR}/src/pugixml.hpp"
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
238 DESTINATION
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
239 ${CMAKE_INSTALL_INCLUDEDIR}${versioned-dir} COMPONENT ${PUGIXML_DEVELOPMENT_COMPONENT})
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
240
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
241 if (PUGIXML_BUILD_TESTS)
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
242 set(fuzz-pattern "tests/fuzz_*.cpp")
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
243 set(test-pattern "tests/*.cpp")
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
244 if (CMAKE_VERSION VERSION_GREATER 3.11)
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
245 list(INSERT fuzz-pattern 0 CONFIGURE_DEPENDS)
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
246 list(INSERT test-pattern 0 CONFIGURE_DEPENDS)
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
247 endif()
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
248 file(GLOB test-sources ${test-pattern})
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
249 file(GLOB fuzz-sources ${fuzz-pattern})
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
250 list(REMOVE_ITEM test-sources ${fuzz-sources})
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
251
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
252 add_custom_target(check
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
253 COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure)
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
254
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
255 add_executable(pugixml-check ${test-sources})
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
256 add_test(NAME pugixml::test
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
257 COMMAND pugixml-check
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
258 WORKING_DIRECTORY ${PROJECT_SOURCE_DIR})
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
259 add_dependencies(check pugixml-check)
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
260 target_link_libraries(pugixml-check
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
261 PRIVATE
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
262 pugixml::pugixml)
d10b6c6b432e add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
263 endif()