1*7c568831SAndroid Build Coastguard Workercmake_minimum_required(VERSION 3.18) 2*7c568831SAndroid Build Coastguard Worker 3*7c568831SAndroid Build Coastguard Workerfile(READ "VERSION" VERSION) 4*7c568831SAndroid Build Coastguard Workerstring(STRIP ${VERSION} VERSION) 5*7c568831SAndroid Build Coastguard Workerif(${VERSION} MATCHES [[([0-9]+)\.([0-9]+)\.([0-9]+)]]) 6*7c568831SAndroid Build Coastguard Worker set(LIBXML_MAJOR_VERSION ${CMAKE_MATCH_1}) 7*7c568831SAndroid Build Coastguard Worker set(LIBXML_MINOR_VERSION ${CMAKE_MATCH_2}) 8*7c568831SAndroid Build Coastguard Worker set(LIBXML_MICRO_VERSION ${CMAKE_MATCH_3}) 9*7c568831SAndroid Build Coastguard Workerendif() 10*7c568831SAndroid Build Coastguard Worker 11*7c568831SAndroid Build Coastguard Workerproject(libxml2 VERSION ${VERSION} LANGUAGES C) 12*7c568831SAndroid Build Coastguard Worker 13*7c568831SAndroid Build Coastguard Workerinclude(CheckCSourceCompiles) 14*7c568831SAndroid Build Coastguard Workerinclude(CheckFunctionExists) 15*7c568831SAndroid Build Coastguard Workerinclude(CheckIncludeFiles) 16*7c568831SAndroid Build Coastguard Workerinclude(CheckLibraryExists) 17*7c568831SAndroid Build Coastguard Workerinclude(CheckLinkerFlag) 18*7c568831SAndroid Build Coastguard Workerinclude(CheckStructHasMember) 19*7c568831SAndroid Build Coastguard Workerinclude(CheckSymbolExists) 20*7c568831SAndroid Build Coastguard Workerinclude(CMakeDependentOption) 21*7c568831SAndroid Build Coastguard Workerinclude(CMakePackageConfigHelpers) 22*7c568831SAndroid Build Coastguard Workerinclude(FindPkgConfig) 23*7c568831SAndroid Build Coastguard Workerinclude(GNUInstallDirs) 24*7c568831SAndroid Build Coastguard Worker 25*7c568831SAndroid Build Coastguard Workeroption(BUILD_SHARED_LIBS "Build shared libraries" ON) 26*7c568831SAndroid Build Coastguard Workerset(LIBXML2_WITH_AUTOMATA ON) 27*7c568831SAndroid Build Coastguard Workeroption(LIBXML2_WITH_CATALOG "Add the Catalog support" ON) 28*7c568831SAndroid Build Coastguard Workeroption(LIBXML2_WITH_DEBUG "Add the debugging module" ON) 29*7c568831SAndroid Build Coastguard Workerset(LIBXML2_WITH_EXPR ON) 30*7c568831SAndroid Build Coastguard Workeroption(LIBXML2_WITH_HTML "Add the HTML support" ON) 31*7c568831SAndroid Build Coastguard Workeroption(LIBXML2_WITH_HTTP "Add the HTTP support" OFF) 32*7c568831SAndroid Build Coastguard Workeroption(LIBXML2_WITH_ICONV "Add ICONV support" ON) 33*7c568831SAndroid Build Coastguard Workeroption(LIBXML2_WITH_ICU "Add ICU support" OFF) 34*7c568831SAndroid Build Coastguard Workeroption(LIBXML2_WITH_ISO8859X "Add ISO8859X support if no iconv" ON) 35*7c568831SAndroid Build Coastguard Workeroption(LIBXML2_WITH_LEGACY "Add deprecated APIs for compatibility" OFF) 36*7c568831SAndroid Build Coastguard Workeroption(LIBXML2_WITH_LZMA "Use liblzma" OFF) 37*7c568831SAndroid Build Coastguard Workeroption(LIBXML2_WITH_MODULES "Add the dynamic modules support" ON) 38*7c568831SAndroid Build Coastguard Workeroption(LIBXML2_WITH_OUTPUT "Add the serialization support" ON) 39*7c568831SAndroid Build Coastguard Workeroption(LIBXML2_WITH_PATTERN "Add the xmlPattern selection interface" ON) 40*7c568831SAndroid Build Coastguard Workeroption(LIBXML2_WITH_PROGRAMS "Build programs" ON) 41*7c568831SAndroid Build Coastguard Workeroption(LIBXML2_WITH_PUSH "Add the PUSH parser interfaces" ON) 42*7c568831SAndroid Build Coastguard Workeroption(LIBXML2_WITH_PYTHON "Build Python bindings" ON) 43*7c568831SAndroid Build Coastguard Workeroption(LIBXML2_WITH_READLINE "readline support for xmllint shell" OFF) 44*7c568831SAndroid Build Coastguard Workeroption(LIBXML2_WITH_REGEXPS "Add Regular Expressions support" ON) 45*7c568831SAndroid Build Coastguard Workeroption(LIBXML2_WITH_SAX1 "Add the older SAX1 interface" ON) 46*7c568831SAndroid Build Coastguard Workeroption(LIBXML2_WITH_TESTS "Build tests" ON) 47*7c568831SAndroid Build Coastguard Workeroption(LIBXML2_WITH_THREADS "Add multithread support" ON) 48*7c568831SAndroid Build Coastguard Workeroption(LIBXML2_WITH_TLS "Enable thread-local storage" OFF) 49*7c568831SAndroid Build Coastguard Workerset(LIBXML2_WITH_UNICODE ON) 50*7c568831SAndroid Build Coastguard Workeroption(LIBXML2_WITH_VALID "Add the DTD validation support" ON) 51*7c568831SAndroid Build Coastguard Workeroption(LIBXML2_WITH_XPATH "Add the XPATH support" ON) 52*7c568831SAndroid Build Coastguard Workeroption(LIBXML2_WITH_ZLIB "Use libz" OFF) 53*7c568831SAndroid Build Coastguard Worker 54*7c568831SAndroid Build Coastguard Workercmake_dependent_option( 55*7c568831SAndroid Build Coastguard Worker LIBXML2_WITH_C14N "Add the Canonicalization support" ON 56*7c568831SAndroid Build Coastguard Worker "LIBXML2_WITH_OUTPUT;LIBXML2_WITH_XPATH" OFF) 57*7c568831SAndroid Build Coastguard Workercmake_dependent_option( 58*7c568831SAndroid Build Coastguard Worker LIBXML2_WITH_HISTORY "history support for xmllint shell" OFF 59*7c568831SAndroid Build Coastguard Worker "LIBXML2_WITH_READLINE" OFF) 60*7c568831SAndroid Build Coastguard Workercmake_dependent_option( 61*7c568831SAndroid Build Coastguard Worker LIBXML2_WITH_READER "Add the xmlReader parsing interface" ON 62*7c568831SAndroid Build Coastguard Worker "LIBXML2_WITH_PUSH" OFF) 63*7c568831SAndroid Build Coastguard Workercmake_dependent_option( 64*7c568831SAndroid Build Coastguard Worker LIBXML2_WITH_SCHEMAS "Add Relax-NG and Schemas support" ON 65*7c568831SAndroid Build Coastguard Worker "LIBXML2_WITH_PATTERN;LIBXML2_WITH_REGEXPS" OFF) 66*7c568831SAndroid Build Coastguard Workercmake_dependent_option( 67*7c568831SAndroid Build Coastguard Worker LIBXML2_WITH_SCHEMATRON "Add Schematron support" ON 68*7c568831SAndroid Build Coastguard Worker "LIBXML2_WITH_PATTERN;LIBXML2_WITH_XPATH" OFF) 69*7c568831SAndroid Build Coastguard Workercmake_dependent_option( 70*7c568831SAndroid Build Coastguard Worker LIBXML2_WITH_THREAD_ALLOC "Add per-thread malloc hooks" OFF 71*7c568831SAndroid Build Coastguard Worker "LIBXML2_WITH_THREADS" OFF) 72*7c568831SAndroid Build Coastguard Workercmake_dependent_option( 73*7c568831SAndroid Build Coastguard Worker LIBXML2_WITH_WRITER "Add the xmlWriter saving interface" ON 74*7c568831SAndroid Build Coastguard Worker "LIBXML2_WITH_OUTPUT;LIBXML2_WITH_PUSH" OFF) 75*7c568831SAndroid Build Coastguard Workercmake_dependent_option( 76*7c568831SAndroid Build Coastguard Worker LIBXML2_WITH_XINCLUDE "Add the XInclude support" ON 77*7c568831SAndroid Build Coastguard Worker "LIBXML2_WITH_XPATH" OFF) 78*7c568831SAndroid Build Coastguard Workercmake_dependent_option( 79*7c568831SAndroid Build Coastguard Worker LIBXML2_WITH_XPTR "Add the XPointer support" ON 80*7c568831SAndroid Build Coastguard Worker "LIBXML2_WITH_XPATH" OFF) 81*7c568831SAndroid Build Coastguard Worker 82*7c568831SAndroid Build Coastguard Workerset(LIBXML2_XMLCONF_WORKING_DIR ${CMAKE_CURRENT_BINARY_DIR} CACHE PATH "Working directory for XML Conformance Test Suite") 83*7c568831SAndroid Build Coastguard Worker 84*7c568831SAndroid Build Coastguard Workerif(LIBXML2_WITH_PYTHON) 85*7c568831SAndroid Build Coastguard Worker find_package(Python COMPONENTS Interpreter Development REQUIRED) 86*7c568831SAndroid Build Coastguard Worker #set(LIBXML2_PYTHON_INSTALL_DIR ${Python_SITEARCH} CACHE PATH "Python bindings install directory") 87*7c568831SAndroid Build Coastguard Worker set(LIBXML2_PYTHON_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/python" 88*7c568831SAndroid Build Coastguard Worker CACHE PATH "Python bindings install directory") 89*7c568831SAndroid Build Coastguard Workerendif() 90*7c568831SAndroid Build Coastguard Worker 91*7c568831SAndroid Build Coastguard Workerforeach(VARIABLE IN ITEMS WITH_AUTOMATA WITH_C14N WITH_CATALOG WITH_DEBUG WITH_EXPR WITH_HTML WITH_HTTP WITH_ICONV WITH_ICU WITH_ISO8859X WITH_LEGACY WITH_LZMA WITH_MODULES WITH_OUTPUT WITH_PATTERN WITH_PUSH WITH_READER WITH_REGEXPS WITH_SAX1 WITH_SCHEMAS WITH_SCHEMATRON WITH_THREADS WITH_THREAD_ALLOC WITH_UNICODE WITH_VALID WITH_WRITER WITH_XINCLUDE WITH_XPATH WITH_XPTR WITH_ZLIB) 92*7c568831SAndroid Build Coastguard Worker if(LIBXML2_${VARIABLE}) 93*7c568831SAndroid Build Coastguard Worker set(${VARIABLE} 1) 94*7c568831SAndroid Build Coastguard Worker else() 95*7c568831SAndroid Build Coastguard Worker set(${VARIABLE} 0) 96*7c568831SAndroid Build Coastguard Worker endif() 97*7c568831SAndroid Build Coastguard Workerendforeach() 98*7c568831SAndroid Build Coastguard Worker 99*7c568831SAndroid Build Coastguard Workerset(LIBXML_VERSION ${VERSION}) 100*7c568831SAndroid Build Coastguard Workerset(LIBXML_VERSION_EXTRA "") 101*7c568831SAndroid Build Coastguard Workermath(EXPR LIBXML_VERSION_NUMBER " 102*7c568831SAndroid Build Coastguard Worker ${LIBXML_MAJOR_VERSION} * 10000 + 103*7c568831SAndroid Build Coastguard Worker ${LIBXML_MINOR_VERSION} * 100 + 104*7c568831SAndroid Build Coastguard Worker ${LIBXML_MICRO_VERSION} 105*7c568831SAndroid Build Coastguard Worker") 106*7c568831SAndroid Build Coastguard Worker 107*7c568831SAndroid Build Coastguard Workerset(MODULE_EXTENSION "${CMAKE_SHARED_LIBRARY_SUFFIX}") 108*7c568831SAndroid Build Coastguard Worker 109*7c568831SAndroid Build Coastguard Workerset(PACKAGE "libxml2") 110*7c568831SAndroid Build Coastguard Workerset(PACKAGE_NAME "libxml2") 111*7c568831SAndroid Build Coastguard Workerset(PACKAGE_STRING "libxml2 ${VERSION}") 112*7c568831SAndroid Build Coastguard Workerset(PACKAGE_TARNAME "libxml2") 113*7c568831SAndroid Build Coastguard Workerset(PACKAGE_URL "https://gitlab.gnome.org/GNOME/libxml2") 114*7c568831SAndroid Build Coastguard Workerset(PACKAGE_VERSION ${VERSION}) 115*7c568831SAndroid Build Coastguard Worker 116*7c568831SAndroid Build Coastguard Workerif(LIBXML2_WITH_ICONV) 117*7c568831SAndroid Build Coastguard Worker find_package(Iconv REQUIRED) 118*7c568831SAndroid Build Coastguard Workerendif() 119*7c568831SAndroid Build Coastguard Worker 120*7c568831SAndroid Build Coastguard Workerif(LIBXML2_WITH_ICU) 121*7c568831SAndroid Build Coastguard Worker find_package(ICU REQUIRED COMPONENTS data i18n uc) 122*7c568831SAndroid Build Coastguard Workerendif() 123*7c568831SAndroid Build Coastguard Worker 124*7c568831SAndroid Build Coastguard Workerif(LIBXML2_WITH_LZMA) 125*7c568831SAndroid Build Coastguard Worker find_package(LibLZMA REQUIRED) 126*7c568831SAndroid Build Coastguard Workerendif() 127*7c568831SAndroid Build Coastguard Worker 128*7c568831SAndroid Build Coastguard Workerif(LIBXML2_WITH_THREADS) 129*7c568831SAndroid Build Coastguard Worker find_package(Threads REQUIRED) 130*7c568831SAndroid Build Coastguard Worker set(THREAD_LIBS ${CMAKE_THREAD_LIBS_INIT}) 131*7c568831SAndroid Build Coastguard Worker list(APPEND CMAKE_REQUIRED_LIBRARIES Threads::Threads) 132*7c568831SAndroid Build Coastguard Workerendif() 133*7c568831SAndroid Build Coastguard Worker 134*7c568831SAndroid Build Coastguard Workerif(LIBXML2_WITH_ZLIB) 135*7c568831SAndroid Build Coastguard Worker find_package(ZLIB REQUIRED) 136*7c568831SAndroid Build Coastguard Workerendif() 137*7c568831SAndroid Build Coastguard Worker 138*7c568831SAndroid Build Coastguard Workercheck_c_source_compiles(" 139*7c568831SAndroid Build Coastguard Worker void __attribute__((destructor)) 140*7c568831SAndroid Build Coastguard Worker f(void) {} 141*7c568831SAndroid Build Coastguard Worker int main(void) { return 0; } 142*7c568831SAndroid Build Coastguard Worker" HAVE_FUNC_ATTRIBUTE_DESTRUCTOR) 143*7c568831SAndroid Build Coastguard Workercheck_symbol_exists(getentropy "sys/random.h" HAVE_DECL_GETENTROPY) 144*7c568831SAndroid Build Coastguard Workercheck_symbol_exists(glob "glob.h" HAVE_DECL_GLOB) 145*7c568831SAndroid Build Coastguard Workercheck_symbol_exists(mmap "sys/mman.h" HAVE_DECL_MMAP) 146*7c568831SAndroid Build Coastguard Workercheck_include_files(stdint.h HAVE_STDINT_H) 147*7c568831SAndroid Build Coastguard Worker 148*7c568831SAndroid Build Coastguard Workerif(LIBXML2_WITH_READLINE) 149*7c568831SAndroid Build Coastguard Worker check_library_exists(readline readline "" HAVE_LIBREADLINE) 150*7c568831SAndroid Build Coastguard Worker if (LIBXML2_WITH_HISTORY) 151*7c568831SAndroid Build Coastguard Worker check_library_exists(history append_history "" HAVE_LIBHISTORY) 152*7c568831SAndroid Build Coastguard Worker endif() 153*7c568831SAndroid Build Coastguard Workerendif() 154*7c568831SAndroid Build Coastguard Worker 155*7c568831SAndroid Build Coastguard Workerif(LIBXML2_WITH_HTTP) 156*7c568831SAndroid Build Coastguard Worker check_include_files(poll.h HAVE_POLL_H) 157*7c568831SAndroid Build Coastguard Workerendif() 158*7c568831SAndroid Build Coastguard Worker 159*7c568831SAndroid Build Coastguard Workerif(LIBXML2_WITH_TLS) 160*7c568831SAndroid Build Coastguard Worker check_c_source_compiles( 161*7c568831SAndroid Build Coastguard Worker "_Thread_local int v; int main(){return 0;}" 162*7c568831SAndroid Build Coastguard Worker XML_THREAD_LOCAL_C11 163*7c568831SAndroid Build Coastguard Worker ) 164*7c568831SAndroid Build Coastguard Worker if (XML_THREAD_LOCAL_C11) 165*7c568831SAndroid Build Coastguard Worker set(XML_THREAD_LOCAL "_Thread_local") 166*7c568831SAndroid Build Coastguard Worker else() 167*7c568831SAndroid Build Coastguard Worker check_c_source_compiles( 168*7c568831SAndroid Build Coastguard Worker "__thread int v; int main(){return 0;}" 169*7c568831SAndroid Build Coastguard Worker XML_THREAD_LOCAL_THREAD 170*7c568831SAndroid Build Coastguard Worker ) 171*7c568831SAndroid Build Coastguard Worker if (XML_THREAD_LOCAL_THREAD) 172*7c568831SAndroid Build Coastguard Worker set(XML_THREAD_LOCAL "__thread") 173*7c568831SAndroid Build Coastguard Worker else() 174*7c568831SAndroid Build Coastguard Worker check_c_source_compiles( 175*7c568831SAndroid Build Coastguard Worker "__declspec(thread) int v; int main(){return 0;}" 176*7c568831SAndroid Build Coastguard Worker XML_THREAD_LOCAL_DECLSPEC 177*7c568831SAndroid Build Coastguard Worker ) 178*7c568831SAndroid Build Coastguard Worker if (XML_THREAD_LOCAL_DECLSPEC) 179*7c568831SAndroid Build Coastguard Worker set(XML_THREAD_LOCAL "__declspec(thread)") 180*7c568831SAndroid Build Coastguard Worker endif() 181*7c568831SAndroid Build Coastguard Worker endif() 182*7c568831SAndroid Build Coastguard Worker endif() 183*7c568831SAndroid Build Coastguard Workerendif() 184*7c568831SAndroid Build Coastguard Worker 185*7c568831SAndroid Build Coastguard Workerset( 186*7c568831SAndroid Build Coastguard Worker LIBXML2_HDRS 187*7c568831SAndroid Build Coastguard Worker include/libxml/c14n.h 188*7c568831SAndroid Build Coastguard Worker include/libxml/catalog.h 189*7c568831SAndroid Build Coastguard Worker include/libxml/chvalid.h 190*7c568831SAndroid Build Coastguard Worker include/libxml/debugXML.h 191*7c568831SAndroid Build Coastguard Worker include/libxml/dict.h 192*7c568831SAndroid Build Coastguard Worker include/libxml/encoding.h 193*7c568831SAndroid Build Coastguard Worker include/libxml/entities.h 194*7c568831SAndroid Build Coastguard Worker include/libxml/globals.h 195*7c568831SAndroid Build Coastguard Worker include/libxml/hash.h 196*7c568831SAndroid Build Coastguard Worker include/libxml/HTMLparser.h 197*7c568831SAndroid Build Coastguard Worker include/libxml/HTMLtree.h 198*7c568831SAndroid Build Coastguard Worker include/libxml/list.h 199*7c568831SAndroid Build Coastguard Worker include/libxml/nanoftp.h 200*7c568831SAndroid Build Coastguard Worker include/libxml/nanohttp.h 201*7c568831SAndroid Build Coastguard Worker include/libxml/parser.h 202*7c568831SAndroid Build Coastguard Worker include/libxml/parserInternals.h 203*7c568831SAndroid Build Coastguard Worker include/libxml/pattern.h 204*7c568831SAndroid Build Coastguard Worker include/libxml/relaxng.h 205*7c568831SAndroid Build Coastguard Worker include/libxml/SAX.h 206*7c568831SAndroid Build Coastguard Worker include/libxml/SAX2.h 207*7c568831SAndroid Build Coastguard Worker include/libxml/schemasInternals.h 208*7c568831SAndroid Build Coastguard Worker include/libxml/schematron.h 209*7c568831SAndroid Build Coastguard Worker include/libxml/threads.h 210*7c568831SAndroid Build Coastguard Worker include/libxml/tree.h 211*7c568831SAndroid Build Coastguard Worker include/libxml/uri.h 212*7c568831SAndroid Build Coastguard Worker include/libxml/valid.h 213*7c568831SAndroid Build Coastguard Worker include/libxml/xinclude.h 214*7c568831SAndroid Build Coastguard Worker include/libxml/xlink.h 215*7c568831SAndroid Build Coastguard Worker include/libxml/xmlIO.h 216*7c568831SAndroid Build Coastguard Worker include/libxml/xmlautomata.h 217*7c568831SAndroid Build Coastguard Worker include/libxml/xmlerror.h 218*7c568831SAndroid Build Coastguard Worker include/libxml/xmlexports.h 219*7c568831SAndroid Build Coastguard Worker include/libxml/xmlmemory.h 220*7c568831SAndroid Build Coastguard Worker include/libxml/xmlmodule.h 221*7c568831SAndroid Build Coastguard Worker include/libxml/xmlreader.h 222*7c568831SAndroid Build Coastguard Worker include/libxml/xmlregexp.h 223*7c568831SAndroid Build Coastguard Worker include/libxml/xmlsave.h 224*7c568831SAndroid Build Coastguard Worker include/libxml/xmlschemas.h 225*7c568831SAndroid Build Coastguard Worker include/libxml/xmlschemastypes.h 226*7c568831SAndroid Build Coastguard Worker include/libxml/xmlstring.h 227*7c568831SAndroid Build Coastguard Worker include/libxml/xmlunicode.h 228*7c568831SAndroid Build Coastguard Worker include/libxml/xmlwriter.h 229*7c568831SAndroid Build Coastguard Worker include/libxml/xpath.h 230*7c568831SAndroid Build Coastguard Worker include/libxml/xpathInternals.h 231*7c568831SAndroid Build Coastguard Worker include/libxml/xpointer.h 232*7c568831SAndroid Build Coastguard Worker) 233*7c568831SAndroid Build Coastguard Worker 234*7c568831SAndroid Build Coastguard Workerset( 235*7c568831SAndroid Build Coastguard Worker LIBXML2_SRCS 236*7c568831SAndroid Build Coastguard Worker buf.c 237*7c568831SAndroid Build Coastguard Worker c14n.c 238*7c568831SAndroid Build Coastguard Worker catalog.c 239*7c568831SAndroid Build Coastguard Worker chvalid.c 240*7c568831SAndroid Build Coastguard Worker debugXML.c 241*7c568831SAndroid Build Coastguard Worker dict.c 242*7c568831SAndroid Build Coastguard Worker encoding.c 243*7c568831SAndroid Build Coastguard Worker entities.c 244*7c568831SAndroid Build Coastguard Worker error.c 245*7c568831SAndroid Build Coastguard Worker globals.c 246*7c568831SAndroid Build Coastguard Worker hash.c 247*7c568831SAndroid Build Coastguard Worker HTMLparser.c 248*7c568831SAndroid Build Coastguard Worker HTMLtree.c 249*7c568831SAndroid Build Coastguard Worker legacy.c 250*7c568831SAndroid Build Coastguard Worker list.c 251*7c568831SAndroid Build Coastguard Worker nanohttp.c 252*7c568831SAndroid Build Coastguard Worker parser.c 253*7c568831SAndroid Build Coastguard Worker parserInternals.c 254*7c568831SAndroid Build Coastguard Worker pattern.c 255*7c568831SAndroid Build Coastguard Worker relaxng.c 256*7c568831SAndroid Build Coastguard Worker SAX2.c 257*7c568831SAndroid Build Coastguard Worker schematron.c 258*7c568831SAndroid Build Coastguard Worker threads.c 259*7c568831SAndroid Build Coastguard Worker tree.c 260*7c568831SAndroid Build Coastguard Worker uri.c 261*7c568831SAndroid Build Coastguard Worker valid.c 262*7c568831SAndroid Build Coastguard Worker xinclude.c 263*7c568831SAndroid Build Coastguard Worker xlink.c 264*7c568831SAndroid Build Coastguard Worker xmlIO.c 265*7c568831SAndroid Build Coastguard Worker xmlmemory.c 266*7c568831SAndroid Build Coastguard Worker xmlmodule.c 267*7c568831SAndroid Build Coastguard Worker xmlreader.c 268*7c568831SAndroid Build Coastguard Worker xmlregexp.c 269*7c568831SAndroid Build Coastguard Worker xmlsave.c 270*7c568831SAndroid Build Coastguard Worker xmlschemas.c 271*7c568831SAndroid Build Coastguard Worker xmlschemastypes.c 272*7c568831SAndroid Build Coastguard Worker xmlstring.c 273*7c568831SAndroid Build Coastguard Worker xmlunicode.c 274*7c568831SAndroid Build Coastguard Worker xmlwriter.c 275*7c568831SAndroid Build Coastguard Worker xpath.c 276*7c568831SAndroid Build Coastguard Worker xpointer.c 277*7c568831SAndroid Build Coastguard Worker xzlib.c 278*7c568831SAndroid Build Coastguard Worker) 279*7c568831SAndroid Build Coastguard Worker 280*7c568831SAndroid Build Coastguard Workerif(WIN32) 281*7c568831SAndroid Build Coastguard Worker list(APPEND LIBXML2_SRCS win32/libxml2.rc) 282*7c568831SAndroid Build Coastguard Worker file( 283*7c568831SAndroid Build Coastguard Worker WRITE 284*7c568831SAndroid Build Coastguard Worker ${CMAKE_CURRENT_BINARY_DIR}/rcVersion.h 285*7c568831SAndroid Build Coastguard Worker "#define LIBXML_MAJOR_VERSION ${LIBXML_MAJOR_VERSION}\n" 286*7c568831SAndroid Build Coastguard Worker "#define LIBXML_MINOR_VERSION ${LIBXML_MINOR_VERSION}\n" 287*7c568831SAndroid Build Coastguard Worker "#define LIBXML_MICRO_VERSION ${LIBXML_MICRO_VERSION}\n" 288*7c568831SAndroid Build Coastguard Worker "#define LIBXML_DOTTED_VERSION \"${VERSION}\"\n" 289*7c568831SAndroid Build Coastguard Worker ) 290*7c568831SAndroid Build Coastguard Workerendif() 291*7c568831SAndroid Build Coastguard Worker 292*7c568831SAndroid Build Coastguard Workeradd_library(LibXml2 ${LIBXML2_HDRS} ${LIBXML2_SRCS}) 293*7c568831SAndroid Build Coastguard Workeradd_library(LibXml2::LibXml2 ALIAS LibXml2) 294*7c568831SAndroid Build Coastguard Worker 295*7c568831SAndroid Build Coastguard Workertarget_compile_definitions(LibXml2 PRIVATE SYSCONFDIR="${CMAKE_INSTALL_FULL_SYSCONFDIR}") 296*7c568831SAndroid Build Coastguard Worker 297*7c568831SAndroid Build Coastguard Workertarget_include_directories( 298*7c568831SAndroid Build Coastguard Worker LibXml2 299*7c568831SAndroid Build Coastguard Worker PUBLIC 300*7c568831SAndroid Build Coastguard Worker $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}> 301*7c568831SAndroid Build Coastguard Worker $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> 302*7c568831SAndroid Build Coastguard Worker $<INSTALL_INTERFACE:$<INSTALL_PREFIX>/${CMAKE_INSTALL_INCLUDEDIR}/libxml2> 303*7c568831SAndroid Build Coastguard Worker) 304*7c568831SAndroid Build Coastguard Worker 305*7c568831SAndroid Build Coastguard Workerif(LIBXML2_WITH_MODULES) 306*7c568831SAndroid Build Coastguard Worker check_library_exists(dl dlopen "" HAVE_DLOPEN) 307*7c568831SAndroid Build Coastguard Worker if(HAVE_DLOPEN) 308*7c568831SAndroid Build Coastguard Worker target_link_libraries(LibXml2 PRIVATE dl) 309*7c568831SAndroid Build Coastguard Worker set(MODULE_LIBS "-ldl") 310*7c568831SAndroid Build Coastguard Worker else() 311*7c568831SAndroid Build Coastguard Worker check_library_exists(dld shl_load "" HAVE_SHLLOAD) 312*7c568831SAndroid Build Coastguard Worker if(HAVE_SHLLOAD) 313*7c568831SAndroid Build Coastguard Worker target_link_libraries(LibXml2 PRIVATE dld) 314*7c568831SAndroid Build Coastguard Worker set(MODULE_LIBS "-ldld") 315*7c568831SAndroid Build Coastguard Worker endif() 316*7c568831SAndroid Build Coastguard Worker endif() 317*7c568831SAndroid Build Coastguard Workerendif() 318*7c568831SAndroid Build Coastguard Worker 319*7c568831SAndroid Build Coastguard Workerif(UNIX) 320*7c568831SAndroid Build Coastguard Worker target_link_libraries(LibXml2 PRIVATE m) 321*7c568831SAndroid Build Coastguard Worker set(LIBM "-lm") 322*7c568831SAndroid Build Coastguard Workerendif() 323*7c568831SAndroid Build Coastguard Worker 324*7c568831SAndroid Build Coastguard Workerif(WIN32) 325*7c568831SAndroid Build Coastguard Worker target_link_libraries(LibXml2 PRIVATE ws2_32) 326*7c568831SAndroid Build Coastguard Worker set(WINSOCK_LIBS "-lws2_32") 327*7c568831SAndroid Build Coastguard Worker target_link_libraries(LibXml2 PRIVATE bcrypt) 328*7c568831SAndroid Build Coastguard Worker set(CRYPTO_LIBS "-lbcrypt") 329*7c568831SAndroid Build Coastguard Workerendif() 330*7c568831SAndroid Build Coastguard Worker 331*7c568831SAndroid Build Coastguard Workerif(LIBXML2_WITH_ICONV) 332*7c568831SAndroid Build Coastguard Worker target_link_libraries(LibXml2 PUBLIC Iconv::Iconv) 333*7c568831SAndroid Build Coastguard Worker if(NOT Iconv_IS_BUILT_IN) 334*7c568831SAndroid Build Coastguard Worker set(ICONV_LIBS "-liconv") 335*7c568831SAndroid Build Coastguard Worker endif() 336*7c568831SAndroid Build Coastguard Workerendif() 337*7c568831SAndroid Build Coastguard Worker 338*7c568831SAndroid Build Coastguard Workerif(LIBXML2_WITH_ICU) 339*7c568831SAndroid Build Coastguard Worker target_link_libraries(LibXml2 PRIVATE ICU::data ICU::i18n ICU::uc) 340*7c568831SAndroid Build Coastguard Worker if(WIN32) 341*7c568831SAndroid Build Coastguard Worker set(ICU_LDFLAGS "-licudt -licuin -licuuc") 342*7c568831SAndroid Build Coastguard Worker else() 343*7c568831SAndroid Build Coastguard Worker set(ICU_LDFLAGS "-licudata -licui18n -licuuc") 344*7c568831SAndroid Build Coastguard Worker endif() 345*7c568831SAndroid Build Coastguard Worker list(APPEND XML_PRIVATE_LIBS "${ICU_LDFLAGS}") 346*7c568831SAndroid Build Coastguard Worker pkg_check_modules(ICU_PC IMPORTED_TARGET icu-i18n) 347*7c568831SAndroid Build Coastguard Worker if(ICU_PC_FOUND) 348*7c568831SAndroid Build Coastguard Worker list(APPEND XML_PC_REQUIRES icu-i18n) 349*7c568831SAndroid Build Coastguard Worker else() 350*7c568831SAndroid Build Coastguard Worker list(APPEND XML_PC_LIBS "${ICU_LDFLAGS}") 351*7c568831SAndroid Build Coastguard Worker endif() 352*7c568831SAndroid Build Coastguard Workerendif() 353*7c568831SAndroid Build Coastguard Worker 354*7c568831SAndroid Build Coastguard Workerif(LIBXML2_WITH_LZMA) 355*7c568831SAndroid Build Coastguard Worker target_link_libraries(LibXml2 PRIVATE LibLZMA::LibLZMA) 356*7c568831SAndroid Build Coastguard Worker set(LibLZMA_LDFLAGS "-llzma") 357*7c568831SAndroid Build Coastguard Worker list(APPEND XML_PRIVATE_LIBS "${LibLZMA_LDFLAGS}") 358*7c568831SAndroid Build Coastguard Worker pkg_check_modules(LibLZMA_PC IMPORTED_TARGET liblzma) 359*7c568831SAndroid Build Coastguard Worker if(LibLZMA_PC_FOUND) 360*7c568831SAndroid Build Coastguard Worker list(APPEND XML_PC_REQUIRES liblzma) 361*7c568831SAndroid Build Coastguard Worker else() 362*7c568831SAndroid Build Coastguard Worker list(APPEND XML_PC_LIBS "${LibLZMA_LDFLAGS}") 363*7c568831SAndroid Build Coastguard Worker endif() 364*7c568831SAndroid Build Coastguard Workerendif() 365*7c568831SAndroid Build Coastguard Worker 366*7c568831SAndroid Build Coastguard Workerif(LIBXML2_WITH_THREADS) 367*7c568831SAndroid Build Coastguard Worker target_link_libraries(LibXml2 PRIVATE Threads::Threads) 368*7c568831SAndroid Build Coastguard Workerendif() 369*7c568831SAndroid Build Coastguard Worker 370*7c568831SAndroid Build Coastguard Workerif(LIBXML2_WITH_ZLIB) 371*7c568831SAndroid Build Coastguard Worker target_link_libraries(LibXml2 PRIVATE ZLIB::ZLIB) 372*7c568831SAndroid Build Coastguard Worker set(ZLIB_LDFLAGS "-lz") 373*7c568831SAndroid Build Coastguard Worker list(APPEND XML_PRIVATE_LIBS "${ZLIB_LDFLAGS}") 374*7c568831SAndroid Build Coastguard Worker pkg_check_modules(ZLIB_PC IMPORTED_TARGET zlib) 375*7c568831SAndroid Build Coastguard Worker if(ZLIB_PC_FOUND) 376*7c568831SAndroid Build Coastguard Worker list(APPEND XML_PC_REQUIRES zlib) 377*7c568831SAndroid Build Coastguard Worker else() 378*7c568831SAndroid Build Coastguard Worker list(APPEND XML_PC_LIBS "${ZLIB_LDFLAGS}") 379*7c568831SAndroid Build Coastguard Worker endif() 380*7c568831SAndroid Build Coastguard Workerendif() 381*7c568831SAndroid Build Coastguard Worker 382*7c568831SAndroid Build Coastguard Workerif(CMAKE_C_COMPILER_ID MATCHES "Clang" OR CMAKE_C_COMPILER_ID STREQUAL "GNU") 383*7c568831SAndroid Build Coastguard Worker # These compiler flags can break the checks above so keep them here. 384*7c568831SAndroid Build Coastguard Worker set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pedantic -Wall -Wextra -Wshadow \ 385*7c568831SAndroid Build Coastguard Worker-Wpointer-arith -Wcast-align -Wwrite-strings \ 386*7c568831SAndroid Build Coastguard Worker-Wstrict-prototypes -Wmissing-prototypes \ 387*7c568831SAndroid Build Coastguard Worker-Wno-long-long -Wno-format-extra-args -Wno-array-bounds") 388*7c568831SAndroid Build Coastguard Worker 389*7c568831SAndroid Build Coastguard Worker if(LIBXML2_WITH_LEGACY AND BUILD_SHARED_LIBS AND UNIX AND NOT APPLE) 390*7c568831SAndroid Build Coastguard Worker check_linker_flag(C "LINKER:--undefined-version" FLAG_UNDEFINED_VERSION) 391*7c568831SAndroid Build Coastguard Worker if (FLAG_UNDEFINED_VERSION) 392*7c568831SAndroid Build Coastguard Worker target_link_options(LibXml2 PRIVATE "LINKER:--undefined-version") 393*7c568831SAndroid Build Coastguard Worker endif() 394*7c568831SAndroid Build Coastguard Worker target_link_options(LibXml2 PRIVATE "LINKER:--version-script=${CMAKE_CURRENT_SOURCE_DIR}/libxml2.syms") 395*7c568831SAndroid Build Coastguard Worker endif() 396*7c568831SAndroid Build Coastguard Workerendif() 397*7c568831SAndroid Build Coastguard Worker 398*7c568831SAndroid Build Coastguard Workerset(LIBXML_MINOR_COMPAT 0) 399*7c568831SAndroid Build Coastguard Workermath(EXPR LIBXML_SOVERSION "${LIBXML_MAJOR_VERSION} + ${LIBXML_MINOR_COMPAT}") 400*7c568831SAndroid Build Coastguard Workerset_target_properties( 401*7c568831SAndroid Build Coastguard Worker LibXml2 402*7c568831SAndroid Build Coastguard Worker PROPERTIES 403*7c568831SAndroid Build Coastguard Worker IMPORT_PREFIX lib 404*7c568831SAndroid Build Coastguard Worker OUTPUT_NAME xml2 405*7c568831SAndroid Build Coastguard Worker POSITION_INDEPENDENT_CODE ON 406*7c568831SAndroid Build Coastguard Worker PREFIX lib 407*7c568831SAndroid Build Coastguard Worker VERSION ${PROJECT_VERSION} 408*7c568831SAndroid Build Coastguard Worker SOVERSION ${LIBXML_SOVERSION} 409*7c568831SAndroid Build Coastguard Worker) 410*7c568831SAndroid Build Coastguard Worker 411*7c568831SAndroid Build Coastguard Workerif(MSVC) 412*7c568831SAndroid Build Coastguard Worker if(BUILD_SHARED_LIBS) 413*7c568831SAndroid Build Coastguard Worker set_target_properties( 414*7c568831SAndroid Build Coastguard Worker LibXml2 415*7c568831SAndroid Build Coastguard Worker PROPERTIES 416*7c568831SAndroid Build Coastguard Worker DEBUG_POSTFIX d 417*7c568831SAndroid Build Coastguard Worker ) 418*7c568831SAndroid Build Coastguard Worker else() 419*7c568831SAndroid Build Coastguard Worker set_target_properties( 420*7c568831SAndroid Build Coastguard Worker LibXml2 421*7c568831SAndroid Build Coastguard Worker PROPERTIES 422*7c568831SAndroid Build Coastguard Worker DEBUG_POSTFIX sd 423*7c568831SAndroid Build Coastguard Worker MINSIZEREL_POSTFIX s 424*7c568831SAndroid Build Coastguard Worker RELEASE_POSTFIX s 425*7c568831SAndroid Build Coastguard Worker RELWITHDEBINFO_POSTFIX s 426*7c568831SAndroid Build Coastguard Worker ) 427*7c568831SAndroid Build Coastguard Worker endif() 428*7c568831SAndroid Build Coastguard Workerendif() 429*7c568831SAndroid Build Coastguard Worker 430*7c568831SAndroid Build Coastguard Workerinstall(FILES ${LIBXML2_HDRS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/libxml2/libxml COMPONENT development) 431*7c568831SAndroid Build Coastguard Worker 432*7c568831SAndroid Build Coastguard Workerinstall( 433*7c568831SAndroid Build Coastguard Worker TARGETS LibXml2 434*7c568831SAndroid Build Coastguard Worker EXPORT LibXml2 435*7c568831SAndroid Build Coastguard Worker ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT development 436*7c568831SAndroid Build Coastguard Worker LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT runtime NAMELINK_COMPONENT development 437*7c568831SAndroid Build Coastguard Worker RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT runtime 438*7c568831SAndroid Build Coastguard Worker) 439*7c568831SAndroid Build Coastguard Worker 440*7c568831SAndroid Build Coastguard Workerif(MSVC AND BUILD_SHARED_LIBS) 441*7c568831SAndroid Build Coastguard Worker install(FILES $<TARGET_PDB_FILE:LibXml2> DESTINATION ${CMAKE_INSTALL_BINDIR} CONFIGURATIONS Debug RelWithDebInfo COMPONENT debug) 442*7c568831SAndroid Build Coastguard Workerendif() 443*7c568831SAndroid Build Coastguard Worker 444*7c568831SAndroid Build Coastguard Workerif(LIBXML2_WITH_PROGRAMS) 445*7c568831SAndroid Build Coastguard Worker add_executable(xmllint xmllint.c shell.c) 446*7c568831SAndroid Build Coastguard Worker add_executable(xmlcatalog xmlcatalog.c) 447*7c568831SAndroid Build Coastguard Worker set( 448*7c568831SAndroid Build Coastguard Worker PROGRAMS 449*7c568831SAndroid Build Coastguard Worker xmlcatalog 450*7c568831SAndroid Build Coastguard Worker xmllint 451*7c568831SAndroid Build Coastguard Worker ) 452*7c568831SAndroid Build Coastguard Worker foreach(PROGRAM ${PROGRAMS}) 453*7c568831SAndroid Build Coastguard Worker add_executable(LibXml2::${PROGRAM} ALIAS ${PROGRAM}) 454*7c568831SAndroid Build Coastguard Worker target_compile_definitions(${PROGRAM} PRIVATE SYSCONFDIR="${CMAKE_INSTALL_FULL_SYSCONFDIR}") 455*7c568831SAndroid Build Coastguard Worker target_link_libraries(${PROGRAM} LibXml2) 456*7c568831SAndroid Build Coastguard Worker if(HAVE_LIBHISTORY) 457*7c568831SAndroid Build Coastguard Worker target_link_libraries(${PROGRAM} history) 458*7c568831SAndroid Build Coastguard Worker endif() 459*7c568831SAndroid Build Coastguard Worker if(HAVE_LIBREADLINE) 460*7c568831SAndroid Build Coastguard Worker target_link_libraries(${PROGRAM} readline) 461*7c568831SAndroid Build Coastguard Worker endif() 462*7c568831SAndroid Build Coastguard Worker install(TARGETS ${PROGRAM} EXPORT LibXml2 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT programs) 463*7c568831SAndroid Build Coastguard Worker endforeach() 464*7c568831SAndroid Build Coastguard Workerendif() 465*7c568831SAndroid Build Coastguard Worker 466*7c568831SAndroid Build Coastguard Workerif(LIBXML2_WITH_TESTS) 467*7c568831SAndroid Build Coastguard Worker enable_testing() 468*7c568831SAndroid Build Coastguard Worker set( 469*7c568831SAndroid Build Coastguard Worker TESTS 470*7c568831SAndroid Build Coastguard Worker runtest 471*7c568831SAndroid Build Coastguard Worker runxmlconf 472*7c568831SAndroid Build Coastguard Worker runsuite 473*7c568831SAndroid Build Coastguard Worker testapi 474*7c568831SAndroid Build Coastguard Worker testchar 475*7c568831SAndroid Build Coastguard Worker testdict 476*7c568831SAndroid Build Coastguard Worker testModule 477*7c568831SAndroid Build Coastguard Worker testlimits 478*7c568831SAndroid Build Coastguard Worker testparser 479*7c568831SAndroid Build Coastguard Worker testrecurse 480*7c568831SAndroid Build Coastguard Worker ) 481*7c568831SAndroid Build Coastguard Worker foreach(TEST ${TESTS}) 482*7c568831SAndroid Build Coastguard Worker add_executable(${TEST} ${TEST}.c) 483*7c568831SAndroid Build Coastguard Worker target_compile_definitions(${TEST} PRIVATE SYSCONFDIR="${CMAKE_INSTALL_FULL_SYSCONFDIR}") 484*7c568831SAndroid Build Coastguard Worker target_link_libraries(${TEST} LibXml2) 485*7c568831SAndroid Build Coastguard Worker endforeach() 486*7c568831SAndroid Build Coastguard Worker if(Threads_FOUND) 487*7c568831SAndroid Build Coastguard Worker foreach(TEST runtest) 488*7c568831SAndroid Build Coastguard Worker target_link_libraries(${TEST} Threads::Threads) 489*7c568831SAndroid Build Coastguard Worker endforeach() 490*7c568831SAndroid Build Coastguard Worker endif() 491*7c568831SAndroid Build Coastguard Worker add_test(NAME runtest COMMAND runtest --out ${CMAKE_CURRENT_BINARY_DIR} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) 492*7c568831SAndroid Build Coastguard Worker add_test(NAME runsuite COMMAND runsuite WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) 493*7c568831SAndroid Build Coastguard Worker if(EXISTS ${LIBXML2_XMLCONF_WORKING_DIR}/xmlconf/xmlconf.xml) 494*7c568831SAndroid Build Coastguard Worker add_test(NAME runxmlconf COMMAND runxmlconf WORKING_DIRECTORY ${LIBXML2_XMLCONF_WORKING_DIR}) 495*7c568831SAndroid Build Coastguard Worker endif() 496*7c568831SAndroid Build Coastguard Worker if(NOT WIN32) 497*7c568831SAndroid Build Coastguard Worker add_test(NAME testapi COMMAND testapi) 498*7c568831SAndroid Build Coastguard Worker endif() 499*7c568831SAndroid Build Coastguard Worker add_test(NAME testchar COMMAND testchar) 500*7c568831SAndroid Build Coastguard Worker add_test(NAME testdict COMMAND testdict) 501*7c568831SAndroid Build Coastguard Worker add_test(NAME testparser COMMAND testparser WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) 502*7c568831SAndroid Build Coastguard Worker add_test(NAME testrecurse COMMAND testrecurse WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) 503*7c568831SAndroid Build Coastguard Workerendif() 504*7c568831SAndroid Build Coastguard Worker 505*7c568831SAndroid Build Coastguard Workerif(LIBXML2_WITH_PYTHON) 506*7c568831SAndroid Build Coastguard Worker execute_process( 507*7c568831SAndroid Build Coastguard Worker COMMAND 508*7c568831SAndroid Build Coastguard Worker ${Python_EXECUTABLE} 509*7c568831SAndroid Build Coastguard Worker ${CMAKE_CURRENT_SOURCE_DIR}/python/generator.py 510*7c568831SAndroid Build Coastguard Worker ${CMAKE_CURRENT_SOURCE_DIR}/doc/libxml2-api.xml 511*7c568831SAndroid Build Coastguard Worker ${CMAKE_CURRENT_SOURCE_DIR}/python/libxml2-python-api.xml 512*7c568831SAndroid Build Coastguard Worker WORKING_DIRECTORY 513*7c568831SAndroid Build Coastguard Worker ${CMAKE_CURRENT_BINARY_DIR} 514*7c568831SAndroid Build Coastguard Worker ) 515*7c568831SAndroid Build Coastguard Worker file(READ python/libxml.py LIBXML_PY) 516*7c568831SAndroid Build Coastguard Worker file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/libxml2.py.in "${LIBXML_PY}") 517*7c568831SAndroid Build Coastguard Worker file(READ ${CMAKE_CURRENT_BINARY_DIR}/libxml2class.py LIBXML2CLASS_PY) 518*7c568831SAndroid Build Coastguard Worker file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/libxml2.py.in "${LIBXML2CLASS_PY}") 519*7c568831SAndroid Build Coastguard Worker configure_file(${CMAKE_CURRENT_BINARY_DIR}/libxml2.py.in libxml2.py COPYONLY) 520*7c568831SAndroid Build Coastguard Worker add_library( 521*7c568831SAndroid Build Coastguard Worker LibXml2Mod 522*7c568831SAndroid Build Coastguard Worker libxml2-py.c 523*7c568831SAndroid Build Coastguard Worker libxml2-py.h 524*7c568831SAndroid Build Coastguard Worker python/libxml.c 525*7c568831SAndroid Build Coastguard Worker python/libxml_wrap.h 526*7c568831SAndroid Build Coastguard Worker python/types.c 527*7c568831SAndroid Build Coastguard Worker ) 528*7c568831SAndroid Build Coastguard Worker target_include_directories( 529*7c568831SAndroid Build Coastguard Worker LibXml2Mod 530*7c568831SAndroid Build Coastguard Worker PUBLIC 531*7c568831SAndroid Build Coastguard Worker $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/python> 532*7c568831SAndroid Build Coastguard Worker ) 533*7c568831SAndroid Build Coastguard Worker target_link_libraries(LibXml2Mod LibXml2 Python::Python) 534*7c568831SAndroid Build Coastguard Worker set_target_properties( 535*7c568831SAndroid Build Coastguard Worker LibXml2Mod 536*7c568831SAndroid Build Coastguard Worker PROPERTIES 537*7c568831SAndroid Build Coastguard Worker IMPORT_PREFIX lib 538*7c568831SAndroid Build Coastguard Worker OUTPUT_NAME xml2mod 539*7c568831SAndroid Build Coastguard Worker PREFIX lib 540*7c568831SAndroid Build Coastguard Worker VERSION ${PROJECT_VERSION} 541*7c568831SAndroid Build Coastguard Worker ) 542*7c568831SAndroid Build Coastguard Worker if (WIN32) 543*7c568831SAndroid Build Coastguard Worker set_target_properties(LibXml2Mod PROPERTIES SUFFIX ".pyd") 544*7c568831SAndroid Build Coastguard Worker endif() 545*7c568831SAndroid Build Coastguard Worker install( 546*7c568831SAndroid Build Coastguard Worker TARGETS LibXml2Mod 547*7c568831SAndroid Build Coastguard Worker ARCHIVE DESTINATION ${LIBXML2_PYTHON_INSTALL_DIR} COMPONENT development 548*7c568831SAndroid Build Coastguard Worker LIBRARY DESTINATION ${LIBXML2_PYTHON_INSTALL_DIR} COMPONENT runtime NAMELINK_COMPONENT development 549*7c568831SAndroid Build Coastguard Worker RUNTIME DESTINATION ${LIBXML2_PYTHON_INSTALL_DIR} COMPONENT runtime 550*7c568831SAndroid Build Coastguard Worker ) 551*7c568831SAndroid Build Coastguard Worker if(MSVC AND BUILD_SHARED_LIBS) 552*7c568831SAndroid Build Coastguard Worker install(FILES $<TARGET_PDB_FILE:LibXml2Mod> DESTINATION ${LIBXML2_PYTHON_INSTALL_DIR} CONFIGURATIONS Debug RelWithDebInfo COMPONENT debug) 553*7c568831SAndroid Build Coastguard Worker endif() 554*7c568831SAndroid Build Coastguard Worker install(FILES python/drv_libxml2.py DESTINATION ${LIBXML2_PYTHON_INSTALL_DIR} COMPONENT runtime) 555*7c568831SAndroid Build Coastguard Worker install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libxml2.py DESTINATION ${LIBXML2_PYTHON_INSTALL_DIR} COMPONENT runtime) 556*7c568831SAndroid Build Coastguard Workerendif() 557*7c568831SAndroid Build Coastguard Worker 558*7c568831SAndroid Build Coastguard Workerinstall(FILES doc/xml2-config.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1 COMPONENT documentation) 559*7c568831SAndroid Build Coastguard Workerif(LIBXML2_WITH_PROGRAMS) 560*7c568831SAndroid Build Coastguard Worker install(FILES doc/xmlcatalog.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1 COMPONENT documentation) 561*7c568831SAndroid Build Coastguard Worker install(FILES doc/xmllint.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1 COMPONENT documentation) 562*7c568831SAndroid Build Coastguard Workerendif() 563*7c568831SAndroid Build Coastguard Workerinstall(DIRECTORY doc/ DESTINATION ${CMAKE_INSTALL_DOCDIR} COMPONENT documentation 564*7c568831SAndroid Build Coastguard Worker PATTERN "Makefile.*" EXCLUDE 565*7c568831SAndroid Build Coastguard Worker PATTERN "meson.build" EXCLUDE 566*7c568831SAndroid Build Coastguard Worker PATTERN "*.1" EXCLUDE 567*7c568831SAndroid Build Coastguard Worker PATTERN "*.py" EXCLUDE 568*7c568831SAndroid Build Coastguard Worker PATTERN "*.res" EXCLUDE 569*7c568831SAndroid Build Coastguard Worker PATTERN "*.xml" EXCLUDE 570*7c568831SAndroid Build Coastguard Worker PATTERN "*.xsl" EXCLUDE) 571*7c568831SAndroid Build Coastguard Worker 572*7c568831SAndroid Build Coastguard Workerconfigure_package_config_file( 573*7c568831SAndroid Build Coastguard Worker libxml2-config.cmake.cmake.in libxml2-config.cmake 574*7c568831SAndroid Build Coastguard Worker INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/libxml2-${PROJECT_VERSION} 575*7c568831SAndroid Build Coastguard Worker) 576*7c568831SAndroid Build Coastguard Worker 577*7c568831SAndroid Build Coastguard Workerinstall( 578*7c568831SAndroid Build Coastguard Worker FILES ${CMAKE_CURRENT_BINARY_DIR}/libxml2-config.cmake 579*7c568831SAndroid Build Coastguard Worker DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/libxml2-${PROJECT_VERSION} 580*7c568831SAndroid Build Coastguard Worker COMPONENT development 581*7c568831SAndroid Build Coastguard Worker) 582*7c568831SAndroid Build Coastguard Worker 583*7c568831SAndroid Build Coastguard Workerwrite_basic_package_version_file( 584*7c568831SAndroid Build Coastguard Worker ${CMAKE_CURRENT_BINARY_DIR}/libxml2-config-version.cmake 585*7c568831SAndroid Build Coastguard Worker VERSION ${PROJECT_VERSION} 586*7c568831SAndroid Build Coastguard Worker COMPATIBILITY ExactVersion 587*7c568831SAndroid Build Coastguard Worker) 588*7c568831SAndroid Build Coastguard Worker 589*7c568831SAndroid Build Coastguard Workerinstall( 590*7c568831SAndroid Build Coastguard Worker FILES ${CMAKE_CURRENT_BINARY_DIR}/libxml2-config-version.cmake 591*7c568831SAndroid Build Coastguard Worker DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/libxml2-${PROJECT_VERSION} 592*7c568831SAndroid Build Coastguard Worker COMPONENT development 593*7c568831SAndroid Build Coastguard Worker) 594*7c568831SAndroid Build Coastguard Worker 595*7c568831SAndroid Build Coastguard Workerinstall( 596*7c568831SAndroid Build Coastguard Worker EXPORT LibXml2 597*7c568831SAndroid Build Coastguard Worker DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/libxml2-${PROJECT_VERSION} 598*7c568831SAndroid Build Coastguard Worker NAMESPACE LibXml2:: 599*7c568831SAndroid Build Coastguard Worker FILE libxml2-export.cmake 600*7c568831SAndroid Build Coastguard Worker COMPONENT development 601*7c568831SAndroid Build Coastguard Worker) 602*7c568831SAndroid Build Coastguard Worker 603*7c568831SAndroid Build Coastguard Workerconfigure_file(config.h.cmake.in config.h) 604*7c568831SAndroid Build Coastguard Workerconfigure_file(include/libxml/xmlversion.h.in libxml/xmlversion.h) 605*7c568831SAndroid Build Coastguard Workerinstall(FILES ${CMAKE_CURRENT_BINARY_DIR}/libxml/xmlversion.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/libxml2/libxml COMPONENT development) 606*7c568831SAndroid Build Coastguard Worker 607*7c568831SAndroid Build Coastguard Workerif(LIBXML2_WITH_PYTHON) 608*7c568831SAndroid Build Coastguard Worker set(prefix "${CMAKE_INSTALL_PREFIX}") 609*7c568831SAndroid Build Coastguard Worker configure_file(python/setup.py.in setup.py @ONLY) 610*7c568831SAndroid Build Coastguard Workerendif() 611*7c568831SAndroid Build Coastguard Worker 612*7c568831SAndroid Build Coastguard Workerset(NON_PC_LIBS "${THREAD_LIBS} ${ICONV_LIBS} ${LIBM} ${WINSOCK_LIBS} ${CRYPTO_LIBS} ${MODULE_LIBS}") 613*7c568831SAndroid Build Coastguard Workerlist(APPEND XML_PC_LIBS "${NON_PC_LIBS}") 614*7c568831SAndroid Build Coastguard Workerlist(APPEND XML_PRIVATE_LIBS "${NON_PC_LIBS}") 615*7c568831SAndroid Build Coastguard Workerlist(REMOVE_DUPLICATES XML_PC_LIBS) 616*7c568831SAndroid Build Coastguard Workerlist(REMOVE_DUPLICATES XML_PRIVATE_LIBS) 617*7c568831SAndroid Build Coastguard Worker 618*7c568831SAndroid Build Coastguard Workerlist(JOIN XML_PC_REQUIRES " " XML_PC_REQUIRES) 619*7c568831SAndroid Build Coastguard Workerlist(JOIN XML_PC_LIBS " " XML_PC_LIBS) 620*7c568831SAndroid Build Coastguard Workerlist(JOIN XML_PRIVATE_LIBS " " XML_PRIVATE_LIBS) 621*7c568831SAndroid Build Coastguard Worker 622*7c568831SAndroid Build Coastguard Workerset(XML_INCLUDEDIR "-I\${includedir}/libxml2") 623*7c568831SAndroid Build Coastguard Workerset(XML_LIBDIR "-L\${libdir}") 624*7c568831SAndroid Build Coastguard Workerset(XML_LIBS "-lxml2") 625*7c568831SAndroid Build Coastguard Worker 626*7c568831SAndroid Build Coastguard Workerif(BUILD_SHARED_LIBS) 627*7c568831SAndroid Build Coastguard Worker set(XML_PC_PRIVATE ".private") 628*7c568831SAndroid Build Coastguard Worker set(XML_PC_LIBS_PRIVATE " 629*7c568831SAndroid Build Coastguard WorkerLibs.private:") 630*7c568831SAndroid Build Coastguard Workerelse() 631*7c568831SAndroid Build Coastguard Worker set(XML_PRIVATE_LIBS_NO_SHARED "${XML_PRIVATE_LIBS}") 632*7c568831SAndroid Build Coastguard Workerendif() 633*7c568831SAndroid Build Coastguard Worker 634*7c568831SAndroid Build Coastguard Workerif(WIN32) 635*7c568831SAndroid Build Coastguard Worker set(XML_STATIC_CFLAGS "-DLIBXML_STATIC") 636*7c568831SAndroid Build Coastguard Worker if (BUILD_SHARED_LIBS) 637*7c568831SAndroid Build Coastguard Worker set(XML_PC_CFLAGS_PRIVATE " 638*7c568831SAndroid Build Coastguard WorkerCflags.private:") 639*7c568831SAndroid Build Coastguard Worker else() 640*7c568831SAndroid Build Coastguard Worker target_compile_definitions(LibXml2 PUBLIC LIBXML_STATIC) 641*7c568831SAndroid Build Coastguard Worker set(XML_CFLAGS "${XML_STATIC_CFLAGS}") 642*7c568831SAndroid Build Coastguard Worker endif() 643*7c568831SAndroid Build Coastguard Workerendif() 644*7c568831SAndroid Build Coastguard Worker 645*7c568831SAndroid Build Coastguard Workerfile(RELATIVE_PATH PACKAGE_RELATIVE_PATH "${CMAKE_INSTALL_FULL_LIBDIR}/pkgconfig" "${CMAKE_INSTALL_PREFIX}") 646*7c568831SAndroid Build Coastguard Workerstring(REGEX REPLACE "/$" "" PACKAGE_RELATIVE_PATH "${PACKAGE_RELATIVE_PATH}") 647*7c568831SAndroid Build Coastguard Worker 648*7c568831SAndroid Build Coastguard Workerif(WIN32) 649*7c568831SAndroid Build Coastguard Worker set(prefix "\${pcfiledir}/${PACKAGE_RELATIVE_PATH}") 650*7c568831SAndroid Build Coastguard Workerelse() 651*7c568831SAndroid Build Coastguard Worker set(prefix "${CMAKE_INSTALL_PREFIX}") 652*7c568831SAndroid Build Coastguard Workerendif() 653*7c568831SAndroid Build Coastguard Workerset(exec_prefix "\${prefix}") 654*7c568831SAndroid Build Coastguard Workerset(libdir "\${prefix}/${CMAKE_INSTALL_LIBDIR}") 655*7c568831SAndroid Build Coastguard Workerset(includedir "\${prefix}/${CMAKE_INSTALL_INCLUDEDIR}") 656*7c568831SAndroid Build Coastguard Workerconfigure_file(libxml-2.0.pc.in libxml-2.0.pc @ONLY) 657*7c568831SAndroid Build Coastguard Workerinstall(FILES ${CMAKE_CURRENT_BINARY_DIR}/libxml-2.0.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig COMPONENT development) 658*7c568831SAndroid Build Coastguard Worker 659*7c568831SAndroid Build Coastguard Workerif(WIN32) 660*7c568831SAndroid Build Coastguard Worker set(prefix "\$(cd \"\$(dirname \"\$0\")\"; pwd -P)/..") 661*7c568831SAndroid Build Coastguard Workerendif() 662*7c568831SAndroid Build Coastguard Workerconfigure_file(xml2-config.in xml2-config @ONLY) 663*7c568831SAndroid Build Coastguard Workerinstall(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/xml2-config DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT development) 664*7c568831SAndroid Build Coastguard Worker 665*7c568831SAndroid Build Coastguard Workerset(XML_INCLUDEDIR "-I${CMAKE_INSTALL_FULL_INCLUDEDIR}/libxml2") 666*7c568831SAndroid Build Coastguard Workerset(XML_LIBDIR "-L${CMAKE_INSTALL_FULL_LIBDIR}") 667*7c568831SAndroid Build Coastguard Worker 668*7c568831SAndroid Build Coastguard Workerset(CPACK_COMPONENT_DEVELOPMENT_DEPENDS runtime) 669*7c568831SAndroid Build Coastguard Workerset(CPACK_COMPONENT_PROGRAMS_DEPENDS runtime) 670*7c568831SAndroid Build Coastguard Workerset(CPACK_DEB_COMPONENT_INSTALL ON) 671*7c568831SAndroid Build Coastguard Workerset(CPACK_DEBIAN_DEVELOPMENT_PACKAGE_DEPENDS "${PACKAGE_TARNAME}") 672*7c568831SAndroid Build Coastguard Workerset(CPACK_DEBIAN_DEVELOPMENT_PACKAGE_NAME "${PACKAGE_TARNAME}-dev") 673*7c568831SAndroid Build Coastguard Workerset(CPACK_DEBIAN_DEVELOPMENT_PACKAGE_SECTION "libdevel") 674*7c568831SAndroid Build Coastguard Workerset(CPACK_DEBIAN_PACKAGE_HOMEPAGE ${PACKAGE_URL}) 675*7c568831SAndroid Build Coastguard Workerset(CPACK_DEBIAN_PACKAGE_NAME ${PACKAGE_TARNAME}) 676*7c568831SAndroid Build Coastguard Workerset(CPACK_DEBIAN_PACKAGE_SECTION "devel") 677*7c568831SAndroid Build Coastguard Workerset(CPACK_DEBIAN_PROGRAMS_PACKAGE_DEPENDS "${PACKAGE_TARNAME}") 678*7c568831SAndroid Build Coastguard Workerset(CPACK_DEBIAN_PROGRAMS_PACKAGE_NAME "${PACKAGE_TARNAME}-utils") 679*7c568831SAndroid Build Coastguard Workerset(CPACK_DEBIAN_PROGRAMS_PACKAGE_SECTION "utils") 680*7c568831SAndroid Build Coastguard Workerset(CPACK_DEBIAN_RUNTIME_PACKAGE_NAME ${PACKAGE_TARNAME}) 681*7c568831SAndroid Build Coastguard Workerset(CPACK_DEBIAN_RUNTIME_PACKAGE_RECOMMENDS "${PACKAGE_TARNAME}-utils") 682*7c568831SAndroid Build Coastguard Workerset(CPACK_DEBIAN_RUNTIME_PACKAGE_SECTION "libs") 683*7c568831SAndroid Build Coastguard Workerset(CPACK_NSIS_PACKAGE_NAME ${PACKAGE_STRING}) 684*7c568831SAndroid Build Coastguard Workerset(CPACK_NSIS_URL_INFO_ABOUT ${PACKAGE_URL}) 685*7c568831SAndroid Build Coastguard Workerset(CPACK_PACKAGE_DISPLAY_NAME ${PACKAGE_STRING}) 686*7c568831SAndroid Build Coastguard Workerset(CPACK_PACKAGE_INSTALL_DIRECTORY "${PACKAGE_TARNAME}-${PACKAGE_VERSION}") 687*7c568831SAndroid Build Coastguard Workerset(CPACK_PACKAGE_NAME ${PACKAGE_TARNAME}) 688*7c568831SAndroid Build Coastguard Workerset(CPACK_PACKAGE_VERSION ${PACKAGE_VERSION}) 689*7c568831SAndroid Build Coastguard Workerset(CPACK_PACKAGE_VERSION_MAJOR ${LIBXML_MAJOR_VERSION}) 690*7c568831SAndroid Build Coastguard Workerset(CPACK_PACKAGE_VERSION_MINOR ${LIBXML_MINOR_VERSION}) 691*7c568831SAndroid Build Coastguard Workerset(CPACK_PACKAGE_VERSION_PATCH ${LIBXML_MICRO_VERSION}) 692*7c568831SAndroid Build Coastguard Workerset(CPACK_RESOURCE_FILE_LICENSE ${CMAKE_CURRENT_SOURCE_DIR}/Copyright) 693*7c568831SAndroid Build Coastguard Workerset(CPACK_RPM_COMPONENT_INSTALL ON) 694*7c568831SAndroid Build Coastguard Workerset(CPACK_RPM_development_PACKAGE_NAME "${PACKAGE_NAME}-devel") 695*7c568831SAndroid Build Coastguard Workerset(CPACK_RPM_development_PACKAGE_REQUIRES "${PACKAGE_NAME}") 696*7c568831SAndroid Build Coastguard Workerset(CPACK_RPM_PACKAGE_GROUP "Development/Libraries") 697*7c568831SAndroid Build Coastguard Workerset(CPACK_RPM_PACKAGE_NAME ${PACKAGE_TARNAME}) 698*7c568831SAndroid Build Coastguard Workerset(CPACK_RPM_PACKAGE_URL ${PACKAGE_URL}) 699*7c568831SAndroid Build Coastguard Workerset(CPACK_RPM_programs_PACKAGE_NAME "${PACKAGE_NAME}-utils") 700*7c568831SAndroid Build Coastguard Workerset(CPACK_RPM_programs_PACKAGE_REQUIRES "${PACKAGE_NAME}") 701*7c568831SAndroid Build Coastguard Workerset(CPACK_RPM_runtime_PACKAGE_NAME "${PACKAGE_NAME}") 702*7c568831SAndroid Build Coastguard Workerset(CPACK_RPM_runtime_PACKAGE_SUGGESTS "${PACKAGE_NAME}-utils") 703*7c568831SAndroid Build Coastguard Worker 704*7c568831SAndroid Build Coastguard Workerinclude(CPack) 705