From ba371452d191e401670aae8c6d4c25ea81516e28 Mon Sep 17 00:00:00 2001 From: Hugh Sorby Date: Wed, 15 Sep 2021 19:27:49 +1200 Subject: [PATCH] Handle the mix of shared and static libXml2 library and zlib library. --- CMakeLists.txt | 1042 ++++++++++++++++++++------------------- libxml2-config.in.cmake | 2 - 2 files changed, 526 insertions(+), 518 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2fbea33..de696df 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -54,53 +54,55 @@ option(LIBXML2_WITH_ZLIB "Use libz" ON) set(LIBXML2_XMLCONF_WORKING_DIR ${CMAKE_CURRENT_BINARY_DIR} CACHE PATH "Working directory for XML Conformance Test Suite") if(LIBXML2_WITH_ICONV) - find_package(Iconv REQUIRED) + find_package(Iconv REQUIRED) endif() if(LIBXML2_WITH_ICU) - find_package(ICU REQUIRED COMPONENTS data i18n uc) + find_package(ICU REQUIRED COMPONENTS data i18n uc) endif() if(LIBXML2_WITH_LZMA) - find_package(LibLZMA REQUIRED) + find_package(LibLZMA REQUIRED) endif() if(LIBXML2_WITH_PYTHON) - check_include_files(unistd.h HAVE_UNISTD_H) - check_symbol_exists(F_GETFL fcntl.h HAVE_F_GETFL) - if(HAVE_UNISTD_H AND HAVE_F_GETFL) - find_package(Python COMPONENTS Interpreter Development REQUIRED) - else() - find_package(Python2 COMPONENTS Interpreter Development REQUIRED) - add_library(Python::Python ALIAS Python2::Python) - set(Python_EXECUTABLE ${Python2_EXECUTABLE}) - set(Python_SITEARCH ${Python2_SITEARCH}) - endif() - set(LIBXML2_PYTHON_INSTALL_DIR ${Python_SITEARCH} CACHE PATH "Python bindings install directory") + check_include_files(unistd.h HAVE_UNISTD_H) + check_symbol_exists(F_GETFL fcntl.h HAVE_F_GETFL) + if(HAVE_UNISTD_H AND HAVE_F_GETFL) + find_package(Python COMPONENTS Interpreter Development REQUIRED) + else() + find_package(Python2 COMPONENTS Interpreter Development REQUIRED) + add_library(Python::Python ALIAS Python2::Python) + set(Python_EXECUTABLE ${Python2_EXECUTABLE}) + set(Python_SITEARCH ${Python2_SITEARCH}) + endif() + set(LIBXML2_PYTHON_INSTALL_DIR ${Python_SITEARCH} CACHE PATH "Python bindings install directory") endif() if(LIBXML2_WITH_THREADS) - find_package(Threads REQUIRED) + find_package(Threads REQUIRED) endif() if(LIBXML2_WITH_ZLIB) - find_package(ZLIB ${ZLIB_VERSION} QUIET CONFIG) - if (ZLIB_FOUND) - set(ZLIB_CONFIG_MODE TRUE) - else () - find_package(ZLIB ${ZLIB_VERSION}) - endif () - if (NOT ZLIB_FOUND) - message(FATAL_ERROR "zlib was NOT found!") - endif () + find_package(ZLIB ${ZLIB_VERSION} QUIET CONFIG) + if (ZLIB_FOUND) + set(ZLIB_CONFIG_MODE TRUE) + get_target_property(_ZLIB_TYPE z TYPE) + else () + find_package(ZLIB ${ZLIB_VERSION}) + set(_ZLIB_TYPE UNKNOWN) + endif () + if (NOT ZLIB_FOUND) + message(FATAL_ERROR "zlib was NOT found!") + endif () endif() foreach(VARIABLE IN ITEMS WITH_AUTOMATA WITH_C14N WITH_CATALOG WITH_DEBUG WITH_DOCB WITH_EXPR WITH_FTP WITH_HTML WITH_HTTP WITH_ICONV WITH_ICU WITH_ISO8859X WITH_LEGACY WITH_LZMA WITH_MEM_DEBUG WITH_MODULES WITH_OUTPUT WITH_PATTERN WITH_PUSH WITH_READER WITH_REGEXPS WITH_RUN_DEBUG WITH_SAX1 WITH_SCHEMAS WITH_SCHEMATRON WITH_THREADS WITH_THREAD_ALLOC WITH_TREE WITH_TRIO WITH_UNICODE WITH_VALID WITH_WRITER WITH_XINCLUDE WITH_XPATH WITH_XPTR WITH_ZLIB) - if(LIBXML2_${VARIABLE}) - set(${VARIABLE} 1) - else() - set(${VARIABLE} 0) - endif() + if(LIBXML2_${VARIABLE}) + set(${VARIABLE} 1) + else() + set(${VARIABLE} 0) + endif() endforeach() set(LIBXML_MAJOR_VERSION ${PROJECT_VERSION_MAJOR}) @@ -124,540 +126,545 @@ set(PACKAGE_URL "http://www.xmlsoft.org/") set(PACKAGE_VERSION ${VERSION}) if(LIBLZMA_FOUND) - list(APPEND CMAKE_REQUIRED_LIBRARIES LibLZMA::LibLZMA) + list(APPEND CMAKE_REQUIRED_LIBRARIES LibLZMA::LibLZMA) endif() if(Threads_FOUND) - list(APPEND CMAKE_REQUIRED_LIBRARIES Threads::Threads) + list(APPEND CMAKE_REQUIRED_LIBRARIES Threads::Threads) endif() if(ZLIB_FOUND) - list(APPEND CMAKE_REQUIRED_LIBRARIES zlib) + list(APPEND CMAKE_REQUIRED_LIBRARIES zlib) endif() if(MSVC) - configure_file(include/win32config.h config.h COPYONLY) + configure_file(include/win32config.h config.h COPYONLY) else() - check_c_source_compiles(" - void __attribute__((destructor)) - f(void) {} - int main(void) { return 0; } - " ATTRIBUTE_DESTRUCTOR) - check_c_source_compiles(" - #include - int main() { (void) gethostbyname((const char*) \"\"); return 0; } - " GETHOSTBYNAME_ARG_CAST_CONST) - if(NOT GETHOSTBYNAME_ARG_CAST_CONST) - set(GETHOSTBYNAME_ARG_CAST "(char *)") - else() - set(GETHOSTBYNAME_ARG_CAST "/**/") - endif() - check_include_files(arpa/inet.h HAVE_ARPA_INET_H) - check_include_files(arpa/nameser.h HAVE_ARPA_NAMESER_H) - check_struct_has_member("struct sockaddr_storage" ss_family "sys/socket.h;sys/types.h" HAVE_SS_FAMILY) - check_struct_has_member("struct sockaddr_storage" __ss_family "sys/socket.h;sys/types.h" HAVE_BROKEN_SS_FAMILY) - if(HAVE_BROKEN_SS_FAMILY) - set(ss_family __ss_family) - endif() - check_function_exists(class HAVE_CLASS) - check_include_files(ctype.h HAVE_CTYPE_H) - check_include_files(dirent.h HAVE_DIRENT_H) - check_include_files(dlfcn.h HAVE_DLFCN_H) - check_library_exists(dl dlopen "" HAVE_DLOPEN) - check_include_files(dl.h HAVE_DL_H) - check_include_files(errno.h HAVE_ERRNO_H) - check_include_files(fcntl.h HAVE_FCNTL_H) - check_function_exists(finite HAVE_FINITE) - check_include_files(float.h HAVE_FLOAT_H) - check_function_exists(fpclass HAVE_FPCLASS) - check_function_exists(fprintf HAVE_FPRINTF) - check_function_exists(fp_class HAVE_FP_CLASS) - check_function_exists(ftime HAVE_FTIME) - check_function_exists(getaddrinfo HAVE_GETADDRINFO) - check_function_exists(gettimeofday HAVE_GETTIMEOFDAY) - check_include_files(inttypes.h HAVE_INTTYPES_H) - check_function_exists(isascii HAVE_ISASCII) - check_function_exists(isinf HAVE_ISINF) - check_function_exists(isnan HAVE_ISNAN) - check_function_exists(isnand HAVE_ISNAND) - check_library_exists(history append_history "" HAVE_LIBHISTORY) - check_library_exists(lzma lzma_code "" HAVE_LIBLZMA) - check_library_exists(pthread pthread_join "" HAVE_LIBPTHREAD) - check_library_exists(readline readline "" HAVE_LIBREADLINE) - check_library_exists(z gzread "" HAVE_LIBZ) - check_include_files(limits.h HAVE_LIMITS_H) - check_function_exists(localtime HAVE_LOCALTIME) - check_include_files(lzma.h HAVE_LZMA_H) - check_include_files(malloc.h HAVE_MALLOC_H) - check_include_files(math.h HAVE_MATH_H) - check_include_files(memory.h HAVE_MEMORY_H) - check_function_exists(mmap HAVE_MMAP) - check_function_exists(munmap HAVE_MUNMAP) - check_symbol_exists(DIR ndir.h HAVE_NDIR_H) - check_include_files(netdb.h HAVE_NETDB_H) - check_include_files(netinet/in.h HAVE_NETINET_IN_H) - check_include_files(poll.h HAVE_POLL_H) - check_function_exists(printf HAVE_PRINTF) - check_include_files(pthread.h HAVE_PTHREAD_H) - check_function_exists(putenv HAVE_PUTENV) - check_function_exists(rand HAVE_RAND) - check_function_exists(rand_r HAVE_RAND_R) - check_include_files(resolv.h HAVE_RESOLV_H) - check_library_exists(dld shl_load "" HAVE_SHLLOAD) - check_function_exists(signal HAVE_SIGNAL) - check_include_files(signal.h HAVE_SIGNAL_H) - check_function_exists(snprintf HAVE_SNPRINTF) - check_function_exists(sprintf HAVE_SPRINTF) - check_function_exists(srand HAVE_SRAND) - check_function_exists(sscanf HAVE_SSCANF) - check_function_exists(stat HAVE_STAT) - check_include_files(stdarg.h HAVE_STDARG_H) - check_include_files(stdint.h HAVE_STDINT_H) - check_include_files(stdlib.h HAVE_STDLIB_H) - check_function_exists(strftime HAVE_STRFTIME) - check_include_files(strings.h HAVE_STRINGS_H) - check_include_files(string.h HAVE_STRING_H) - check_symbol_exists(DIR sys/dir.h HAVE_SYS_DIR_H) - check_include_files(sys/mman.h HAVE_SYS_MMAN_H) - check_symbol_exists(DIR sys/ndir.h HAVE_SYS_NDIR_H) - check_include_files(sys/select.h HAVE_SYS_SELECT_H) - check_include_files(sys/socket.h HAVE_SYS_SOCKET_H) - check_include_files(sys/stat.h HAVE_SYS_STAT_H) - check_include_files(sys/timeb.h HAVE_SYS_TIMEB_H) - check_include_files(sys/time.h HAVE_SYS_TIME_H) - check_include_files(sys/types.h HAVE_SYS_TYPES_H) - check_function_exists(time HAVE_TIME) - check_include_files(time.h HAVE_TIME_H) - check_include_files(unistd.h HAVE_UNISTD_H) - check_function_exists(va_copy HAVE_VA_COPY) - check_function_exists(vfprintf HAVE_VFPRINTF) - check_function_exists(vsnprintf HAVE_VSNPRINTF) - check_function_exists(vsprintf HAVE_VSPRINTF) - check_function_exists(__va_copy HAVE___VA_COPY) - check_c_source_compiles(" - #include - #include - extern - #ifdef __cplusplus - \"C\" - #endif - #if defined(__STDC__) || defined(__cplusplus) - size_t iconv(iconv_t cd, char** inbuf, size_t* inbytesleft, char** outbuf, size_t* outbytesleft); - #else - size_t iconv(); - #endif - int main() { return 0; } - " ICONV_CONST_TEST) - if(NOT ICONV_CONST_TEST) - set(ICONV_CONST "const") - endif() - set(LT_OBJDIR ".libs/") - check_c_source_compiles(" - #include - #include - int main() { (void) send(1, (const char*) \"\", 1, 1); return 0; } - " SEND_ARG2_CAST_CONST) - if(NOT SEND_ARG2_CAST_CONST) - set(SEND_ARG2_CAST "(char *)") - else() - set(SEND_ARG2_CAST "/**/") - endif() - check_include_files("float.h;stdarg.h;stdlib.h;string.h" STDC_HEADERS) - check_c_source_compiles(" - #include - void a(va_list* ap) {}; - int main() { va_list ap1, ap2; a(&ap1); ap2 = (va_list) ap1; return 0; } - " VA_LIST_IS_ARRAY_TEST) - if(VA_LIST_IS_ARRAY_TEST) - set(VA_LIST_IS_ARRAY FALSE) - else() - set(VA_LIST_IS_ARRAY TRUE) - endif() - check_c_source_compiles(" - #include - #include - #include - int main() { (void) getsockopt(1, 1, 1, NULL, (socklen_t*) NULL); return 0; } - " XML_SOCKLEN_T_SOCKLEN_T) - if(XML_SOCKLEN_T_SOCKLEN_T) - set(XML_SOCKLEN_T socklen_t) - else() - check_c_source_compiles(" - #include - #include - #include - int main() { (void) getsockopt(1, 1, 1, NULL, (size_t*) NULL); return 0; } - " XML_SOCKLEN_T_SIZE_T) - if(XML_SOCKLEN_T_SIZE_T) - set(XML_SOCKLEN_T size_t) - else() - check_c_source_compiles(" - #include - #include - #include - int main() { (void) getsockopt (1, 1, 1, NULL, (int*) NULL); return 0; } - " XML_SOCKLEN_T_INT) - set(XML_SOCKLEN_T int) - endif() - endif() - configure_file(config.h.cmake.in config.h) + check_c_source_compiles(" + void __attribute__((destructor)) + f(void) {} + int main(void) { return 0; } + " ATTRIBUTE_DESTRUCTOR) + check_c_source_compiles(" + #include + int main() { (void) gethostbyname((const char*) \"\"); return 0; } + " GETHOSTBYNAME_ARG_CAST_CONST) + if(NOT GETHOSTBYNAME_ARG_CAST_CONST) + set(GETHOSTBYNAME_ARG_CAST "(char *)") + else() + set(GETHOSTBYNAME_ARG_CAST "/**/") + endif() + check_include_files(arpa/inet.h HAVE_ARPA_INET_H) + check_include_files(arpa/nameser.h HAVE_ARPA_NAMESER_H) + check_struct_has_member("struct sockaddr_storage" ss_family "sys/socket.h;sys/types.h" HAVE_SS_FAMILY) + check_struct_has_member("struct sockaddr_storage" __ss_family "sys/socket.h;sys/types.h" HAVE_BROKEN_SS_FAMILY) + if(HAVE_BROKEN_SS_FAMILY) + set(ss_family __ss_family) + endif() + check_function_exists(class HAVE_CLASS) + check_include_files(ctype.h HAVE_CTYPE_H) + check_include_files(dirent.h HAVE_DIRENT_H) + check_include_files(dlfcn.h HAVE_DLFCN_H) + check_library_exists(dl dlopen "" HAVE_DLOPEN) + check_include_files(dl.h HAVE_DL_H) + check_include_files(errno.h HAVE_ERRNO_H) + check_include_files(fcntl.h HAVE_FCNTL_H) + check_function_exists(finite HAVE_FINITE) + check_include_files(float.h HAVE_FLOAT_H) + check_function_exists(fpclass HAVE_FPCLASS) + check_function_exists(fprintf HAVE_FPRINTF) + check_function_exists(fp_class HAVE_FP_CLASS) + check_function_exists(ftime HAVE_FTIME) + check_function_exists(getaddrinfo HAVE_GETADDRINFO) + check_function_exists(gettimeofday HAVE_GETTIMEOFDAY) + check_include_files(inttypes.h HAVE_INTTYPES_H) + check_function_exists(isascii HAVE_ISASCII) + check_function_exists(isinf HAVE_ISINF) + check_function_exists(isnan HAVE_ISNAN) + check_function_exists(isnand HAVE_ISNAND) + check_library_exists(history append_history "" HAVE_LIBHISTORY) + check_library_exists(lzma lzma_code "" HAVE_LIBLZMA) + check_library_exists(pthread pthread_join "" HAVE_LIBPTHREAD) + check_library_exists(readline readline "" HAVE_LIBREADLINE) + check_library_exists(z gzread "" HAVE_LIBZ) + check_include_files(limits.h HAVE_LIMITS_H) + check_function_exists(localtime HAVE_LOCALTIME) + check_include_files(lzma.h HAVE_LZMA_H) + check_include_files(malloc.h HAVE_MALLOC_H) + check_include_files(math.h HAVE_MATH_H) + check_include_files(memory.h HAVE_MEMORY_H) + check_function_exists(mmap HAVE_MMAP) + check_function_exists(munmap HAVE_MUNMAP) + check_symbol_exists(DIR ndir.h HAVE_NDIR_H) + check_include_files(netdb.h HAVE_NETDB_H) + check_include_files(netinet/in.h HAVE_NETINET_IN_H) + check_include_files(poll.h HAVE_POLL_H) + check_function_exists(printf HAVE_PRINTF) + check_include_files(pthread.h HAVE_PTHREAD_H) + check_function_exists(putenv HAVE_PUTENV) + check_function_exists(rand HAVE_RAND) + check_function_exists(rand_r HAVE_RAND_R) + check_include_files(resolv.h HAVE_RESOLV_H) + check_library_exists(dld shl_load "" HAVE_SHLLOAD) + check_function_exists(signal HAVE_SIGNAL) + check_include_files(signal.h HAVE_SIGNAL_H) + check_function_exists(snprintf HAVE_SNPRINTF) + check_function_exists(sprintf HAVE_SPRINTF) + check_function_exists(srand HAVE_SRAND) + check_function_exists(sscanf HAVE_SSCANF) + check_function_exists(stat HAVE_STAT) + check_include_files(stdarg.h HAVE_STDARG_H) + check_include_files(stdint.h HAVE_STDINT_H) + check_include_files(stdlib.h HAVE_STDLIB_H) + check_function_exists(strftime HAVE_STRFTIME) + check_include_files(strings.h HAVE_STRINGS_H) + check_include_files(string.h HAVE_STRING_H) + check_symbol_exists(DIR sys/dir.h HAVE_SYS_DIR_H) + check_include_files(sys/mman.h HAVE_SYS_MMAN_H) + check_symbol_exists(DIR sys/ndir.h HAVE_SYS_NDIR_H) + check_include_files(sys/select.h HAVE_SYS_SELECT_H) + check_include_files(sys/socket.h HAVE_SYS_SOCKET_H) + check_include_files(sys/stat.h HAVE_SYS_STAT_H) + check_include_files(sys/timeb.h HAVE_SYS_TIMEB_H) + check_include_files(sys/time.h HAVE_SYS_TIME_H) + check_include_files(sys/types.h HAVE_SYS_TYPES_H) + check_function_exists(time HAVE_TIME) + check_include_files(time.h HAVE_TIME_H) + check_include_files(unistd.h HAVE_UNISTD_H) + check_function_exists(va_copy HAVE_VA_COPY) + check_function_exists(vfprintf HAVE_VFPRINTF) + check_function_exists(vsnprintf HAVE_VSNPRINTF) + check_function_exists(vsprintf HAVE_VSPRINTF) + check_function_exists(__va_copy HAVE___VA_COPY) + check_c_source_compiles(" + #include + #include + extern + #ifdef __cplusplus + \"C\" + #endif + #if defined(__STDC__) || defined(__cplusplus) + size_t iconv(iconv_t cd, char** inbuf, size_t* inbytesleft, char** outbuf, size_t* outbytesleft); + #else + size_t iconv(); + #endif + int main() { return 0; } + " ICONV_CONST_TEST) + if(NOT ICONV_CONST_TEST) + set(ICONV_CONST "const") + endif() + set(LT_OBJDIR ".libs/") + check_c_source_compiles(" + #include + #include + int main() { (void) send(1, (const char*) \"\", 1, 1); return 0; } + " SEND_ARG2_CAST_CONST) + if(NOT SEND_ARG2_CAST_CONST) + set(SEND_ARG2_CAST "(char *)") + else() + set(SEND_ARG2_CAST "/**/") + endif() + check_include_files("float.h;stdarg.h;stdlib.h;string.h" STDC_HEADERS) + check_c_source_compiles(" + #include + void a(va_list* ap) {}; + int main() { va_list ap1, ap2; a(&ap1); ap2 = (va_list) ap1; return 0; } + " VA_LIST_IS_ARRAY_TEST) + if(VA_LIST_IS_ARRAY_TEST) + set(VA_LIST_IS_ARRAY FALSE) + else() + set(VA_LIST_IS_ARRAY TRUE) + endif() + check_c_source_compiles(" + #include + #include + #include + int main() { (void) getsockopt(1, 1, 1, NULL, (socklen_t*) NULL); return 0; } + " XML_SOCKLEN_T_SOCKLEN_T) + if(XML_SOCKLEN_T_SOCKLEN_T) + set(XML_SOCKLEN_T socklen_t) + else() + check_c_source_compiles(" + #include + #include + #include + int main() { (void) getsockopt(1, 1, 1, NULL, (size_t*) NULL); return 0; } + " XML_SOCKLEN_T_SIZE_T) + if(XML_SOCKLEN_T_SIZE_T) + set(XML_SOCKLEN_T size_t) + else() + check_c_source_compiles(" + #include + #include + #include + int main() { (void) getsockopt (1, 1, 1, NULL, (int*) NULL); return 0; } + " XML_SOCKLEN_T_INT) + set(XML_SOCKLEN_T int) + endif() + endif() + configure_file(config.h.cmake.in config.h) endif() set( - LIBXML2_HDRS - include/libxml/c14n.h - include/libxml/catalog.h - include/libxml/chvalid.h - include/libxml/debugXML.h - include/libxml/dict.h - include/libxml/DOCBparser.h - include/libxml/encoding.h - include/libxml/entities.h - include/libxml/globals.h - include/libxml/hash.h - include/libxml/HTMLparser.h - include/libxml/HTMLtree.h - include/libxml/list.h - include/libxml/nanoftp.h - include/libxml/nanohttp.h - include/libxml/parser.h - include/libxml/parserInternals.h - include/libxml/pattern.h - include/libxml/relaxng.h - include/libxml/SAX.h - include/libxml/SAX2.h - include/libxml/schemasInternals.h - include/libxml/schematron.h - include/libxml/threads.h - include/libxml/tree.h - include/libxml/uri.h - include/libxml/valid.h - include/libxml/xinclude.h - include/libxml/xlink.h - include/libxml/xmlIO.h - include/libxml/xmlautomata.h - include/libxml/xmlerror.h - include/libxml/xmlexports.h - include/libxml/xmlmemory.h - include/libxml/xmlmodule.h - include/libxml/xmlreader.h - include/libxml/xmlregexp.h - include/libxml/xmlsave.h - include/libxml/xmlschemas.h - include/libxml/xmlschemastypes.h - include/libxml/xmlstring.h - include/libxml/xmlunicode.h - include/libxml/xmlwriter.h - include/libxml/xpath.h - include/libxml/xpathInternals.h - include/libxml/xpointer.h + LIBXML2_HDRS + include/libxml/c14n.h + include/libxml/catalog.h + include/libxml/chvalid.h + include/libxml/debugXML.h + include/libxml/dict.h + include/libxml/DOCBparser.h + include/libxml/encoding.h + include/libxml/entities.h + include/libxml/globals.h + include/libxml/hash.h + include/libxml/HTMLparser.h + include/libxml/HTMLtree.h + include/libxml/list.h + include/libxml/nanoftp.h + include/libxml/nanohttp.h + include/libxml/parser.h + include/libxml/parserInternals.h + include/libxml/pattern.h + include/libxml/relaxng.h + include/libxml/SAX.h + include/libxml/SAX2.h + include/libxml/schemasInternals.h + include/libxml/schematron.h + include/libxml/threads.h + include/libxml/tree.h + include/libxml/uri.h + include/libxml/valid.h + include/libxml/xinclude.h + include/libxml/xlink.h + include/libxml/xmlIO.h + include/libxml/xmlautomata.h + include/libxml/xmlerror.h + include/libxml/xmlexports.h + include/libxml/xmlmemory.h + include/libxml/xmlmodule.h + include/libxml/xmlreader.h + include/libxml/xmlregexp.h + include/libxml/xmlsave.h + include/libxml/xmlschemas.h + include/libxml/xmlschemastypes.h + include/libxml/xmlstring.h + include/libxml/xmlunicode.h + include/libxml/xmlwriter.h + include/libxml/xpath.h + include/libxml/xpathInternals.h + include/libxml/xpointer.h ) set( - LIBXML2_SRCS - buf.c - c14n.c - catalog.c - chvalid.c - debugXML.c - dict.c - encoding.c - entities.c - error.c - globals.c - hash.c - HTMLparser.c - HTMLtree.c - legacy.c - list.c - nanoftp.c - nanohttp.c - parser.c - parserInternals.c - pattern.c - relaxng.c - SAX.c - SAX2.c - schematron.c - threads.c - tree.c - uri.c - valid.c - xinclude.c - xlink.c - xmlIO.c - xmlmemory.c - xmlmodule.c - xmlreader.c - xmlregexp.c - xmlsave.c - xmlschemas.c - xmlschemastypes.c - xmlstring.c - xmlunicode.c - xmlwriter.c - xpath.c - xpointer.c - xzlib.c + LIBXML2_SRCS + buf.c + c14n.c + catalog.c + chvalid.c + debugXML.c + dict.c + encoding.c + entities.c + error.c + globals.c + hash.c + HTMLparser.c + HTMLtree.c + legacy.c + list.c + nanoftp.c + nanohttp.c + parser.c + parserInternals.c + pattern.c + relaxng.c + SAX.c + SAX2.c + schematron.c + threads.c + tree.c + uri.c + valid.c + xinclude.c + xlink.c + xmlIO.c + xmlmemory.c + xmlmodule.c + xmlreader.c + xmlregexp.c + xmlsave.c + xmlschemas.c + xmlschemastypes.c + xmlstring.c + xmlunicode.c + xmlwriter.c + xpath.c + xpointer.c + xzlib.c ) if(WIN32) - list(APPEND LIBXML2_SRCS win32/libxml2.rc) - file( - WRITE - ${CMAKE_CURRENT_BINARY_DIR}/rcVersion.h - "#define LIBXML_MAJOR_VERSION ${LIBXML_MAJOR_VERSION}\n" - "#define LIBXML_MINOR_VERSION ${LIBXML_MINOR_VERSION}\n" - "#define LIBXML_MICRO_VERSION ${LIBXML_MICRO_VERSION}\n" - "#define LIBXML_DOTTED_VERSION \"${VERSION}\"\n" - ) + list(APPEND LIBXML2_SRCS win32/libxml2.rc) + file( + WRITE + ${CMAKE_CURRENT_BINARY_DIR}/rcVersion.h + "#define LIBXML_MAJOR_VERSION ${LIBXML_MAJOR_VERSION}\n" + "#define LIBXML_MINOR_VERSION ${LIBXML_MINOR_VERSION}\n" + "#define LIBXML_MICRO_VERSION ${LIBXML_MICRO_VERSION}\n" + "#define LIBXML_DOTTED_VERSION \"${VERSION}\"\n" + ) endif() if(LIBXML2_WITH_SAX1) - list(APPEND LIBXML2_SRCS DOCBparser.c) + list(APPEND LIBXML2_SRCS DOCBparser.c) endif() if(LIBXML2_WITH_TRIO) - list(APPEND LIBXML2_SRCS trio.c triostr.c) + list(APPEND LIBXML2_SRCS trio.c triostr.c) endif() add_library(LibXml2 ${LIBXML2_HDRS} ${LIBXML2_SRCS}) if(NOT BUILD_SHARED_LIBS) - target_compile_definitions(LibXml2 INTERFACE LIBXML_STATIC) - set(XML_CFLAGS "-DLIBXML_STATIC") + target_compile_definitions(LibXml2 INTERFACE LIBXML_STATIC) + set(XML_CFLAGS "-DLIBXML_STATIC") endif() if(LIBXML2_WITH_THREADS) - target_compile_definitions(LibXml2 PRIVATE _REENTRANT) - if(WIN32) - target_compile_definitions(LibXml2 PRIVATE HAVE_WIN32_THREADS) - endif() + target_compile_definitions(LibXml2 PRIVATE _REENTRANT) + if(WIN32) + target_compile_definitions(LibXml2 PRIVATE HAVE_WIN32_THREADS) + endif() endif() target_include_directories( - LibXml2 - PUBLIC - $ - $ - $/${CMAKE_INSTALL_INCLUDEDIR}/libxml2> + LibXml2 + PUBLIC + $ + $ + $/${CMAKE_INSTALL_INCLUDEDIR}/libxml2> ) if(HAVE_DLOPEN) - target_link_libraries(LibXml2 PRIVATE dl) - set(MODULE_PLATFORM_LIBS "-ldl") + target_link_libraries(LibXml2 PRIVATE dl) + set(MODULE_PLATFORM_LIBS "-ldl") endif() if(HAVE_SHLLOAD) - target_link_libraries(LibXml2 PRIVATE dld) - set(MODULE_PLATFORM_LIBS "-ldld") + target_link_libraries(LibXml2 PRIVATE dld) + set(MODULE_PLATFORM_LIBS "-ldld") endif() if(UNIX) - target_link_libraries(LibXml2 PRIVATE m) - set(M_LIBS "-lm") + target_link_libraries(LibXml2 PRIVATE m) + set(M_LIBS "-lm") endif() if(WIN32) - target_link_libraries(LibXml2 PRIVATE ws2_32) - set(WIN32_EXTRA_LIBADD "-lws2_32") + target_link_libraries(LibXml2 PRIVATE ws2_32) + set(WIN32_EXTRA_LIBADD "-lws2_32") endif() if(LIBXML2_WITH_ICONV) - target_link_libraries(LibXml2 PUBLIC Iconv::Iconv) - if(NOT Iconv_IS_BUILT_IN) - set(ICONV_LIBS "-liconv") - endif() + target_link_libraries(LibXml2 PUBLIC Iconv::Iconv) + if(NOT Iconv_IS_BUILT_IN) + set(ICONV_LIBS "-liconv") + endif() endif() if(LIBXML2_WITH_ICU) - target_link_libraries(LibXml2 PRIVATE ICU::data ICU::i18n ICU::uc) - if(WIN32) - set(ICU_LIBS "-licudt -licuin -licuuc") - else() - set(ICU_LIBS "-licudata -licui18n -licuuc") - endif() + target_link_libraries(LibXml2 PRIVATE ICU::data ICU::i18n ICU::uc) + if(WIN32) + set(ICU_LIBS "-licudt -licuin -licuuc") + else() + set(ICU_LIBS "-licudata -licui18n -licuuc") + endif() endif() if(LIBXML2_WITH_LZMA) - target_link_libraries(LibXml2 PRIVATE LibLZMA::LibLZMA) - set(LZMA_LIBS "-llzma") + target_link_libraries(LibXml2 PRIVATE LibLZMA::LibLZMA) + set(LZMA_LIBS "-llzma") endif() if(LIBXML2_WITH_THREADS) - target_link_libraries(LibXml2 PRIVATE Threads::Threads) - set(THREAD_LIBS ${CMAKE_THREAD_LIBS_INIT}) + target_link_libraries(LibXml2 PRIVATE Threads::Threads) + set(THREAD_LIBS ${CMAKE_THREAD_LIBS_INIT}) endif() if(LIBXML2_WITH_ZLIB) - target_link_libraries(LibXml2 PUBLIC zlib) - #set(Z_LIBS "-lz") + if(_ZLIB_TYPE STREQUAL "STATIC_LIBRARY" AND BUILD_SHARED_LIBS) + set(ZLIB_LINK_TYPE PRIVATE) + else() + set(ZLIB_LINK_TYPE PUBLIC) + endif() + target_link_libraries(LibXml2 ${ZLIB_LINK_TYPE} zlib) + #set(Z_LIBS "-lz") endif() set_target_properties( - LibXml2 - PROPERTIES - IMPORT_PREFIX lib - OUTPUT_NAME xml2 - POSITION_INDEPENDENT_CODE ON - PREFIX lib - VERSION ${PROJECT_VERSION} + LibXml2 + PROPERTIES + IMPORT_PREFIX lib + OUTPUT_NAME xml2 + POSITION_INDEPENDENT_CODE ON + PREFIX lib + VERSION ${PROJECT_VERSION} ) if(MSVC) - if(BUILD_SHARED_LIBS) - set_target_properties( - LibXml2 - PROPERTIES - DEBUG_POSTFIX d - ) - else() - set_target_properties( - LibXml2 - PROPERTIES - DEBUG_POSTFIX sd - MINSIZEREL_POSTFIX s - RELEASE_POSTFIX s - RELWITHDEBINFO_POSTFIX s - ) - endif() + if(BUILD_SHARED_LIBS) + set_target_properties( + LibXml2 + PROPERTIES + DEBUG_POSTFIX d + ) + else() + set_target_properties( + LibXml2 + PROPERTIES + DEBUG_POSTFIX sd + MINSIZEREL_POSTFIX s + RELEASE_POSTFIX s + RELWITHDEBINFO_POSTFIX s + ) + endif() endif() install(FILES ${LIBXML2_HDRS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/libxml2/libxml COMPONENT development) install( - TARGETS LibXml2 - EXPORT libxml2-exports - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT development - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT runtime NAMELINK_COMPONENT development - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT runtime + TARGETS LibXml2 + EXPORT libxml2-exports + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT development + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT runtime NAMELINK_COMPONENT development + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT runtime ) if(MSVC AND BUILD_SHARED_LIBS) - install(FILES $ DESTINATION ${CMAKE_INSTALL_BINDIR} CONFIGURATIONS Debug RelWithDebInfo COMPONENT debug) + install(FILES $ DESTINATION ${CMAKE_INSTALL_BINDIR} CONFIGURATIONS Debug RelWithDebInfo COMPONENT debug) endif() if(LIBXML2_WITH_PROGRAMS) - set( - PROGRAMS - xmlcatalog - xmllint - ) - foreach(PROGRAM ${PROGRAMS}) - add_executable(${PROGRAM} ${PROGRAM}.c) - target_link_libraries(${PROGRAM} LibXml2) - if(HAVE_LIBHISTORY) - target_link_libraries(${PROGRAM} history) - endif() - if(HAVE_LIBREADLINE) - target_link_libraries(${PROGRAM} readline) - endif() - install(TARGETS ${PROGRAM} EXPORT libxml2-exports RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT programs) - endforeach() + set( + PROGRAMS + xmlcatalog + xmllint + ) + foreach(PROGRAM ${PROGRAMS}) + add_executable(${PROGRAM} ${PROGRAM}.c) + target_link_libraries(${PROGRAM} LibXml2) + if(HAVE_LIBHISTORY) + target_link_libraries(${PROGRAM} history) + endif() + if(HAVE_LIBREADLINE) + target_link_libraries(${PROGRAM} readline) + endif() + install(TARGETS ${PROGRAM} EXPORT libxml2-exports RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT programs) + endforeach() endif() if(LIBXML2_WITH_TESTS) - enable_testing() - set( - TESTS - runxmlconf - runsuite - testapi - testAutomata - testC14N - testchar - testdict - testHTML - testModule - testlimits - testReader - testrecurse - testRegexp - testRelax - testSAX - testSchemas - testURI - testXPath - ) - foreach(TEST ${TESTS}) - add_executable(${TEST} ${TEST}.c) - target_link_libraries(${TEST} LibXml2) - endforeach() - if(EXISTS ${LIBXML2_XMLCONF_WORKING_DIR}/xmlconf/xmlconf.xml) - add_test(NAME runxmlconf COMMAND runxmlconf WORKING_DIRECTORY ${LIBXML2_XMLCONF_WORKING_DIR}) - endif() - if(NOT WIN32) - add_test(NAME testapi COMMAND testapi) - endif() - add_test(NAME testchar COMMAND testchar) - add_test(NAME testdict COMMAND testdict) - add_test(NAME testrecurse COMMAND testrecurse WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) - if(Threads_FOUND) - set( - TESTS_THREADS - runtest - testThreads - ) - foreach(TEST ${TESTS_THREADS}) - add_executable(${TEST} ${TEST}.c) - if(WIN32) - target_compile_definitions(${TEST} PRIVATE HAVE_WIN32_THREADS) - endif() - target_link_libraries(${TEST} LibXml2 Threads::Threads) - endforeach() - add_test(NAME runtest COMMAND runtest --out ${CMAKE_CURRENT_BINARY_DIR} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) - add_test(NAME testThreads COMMAND testThreads WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) - endif() + enable_testing() + set( + TESTS + runxmlconf + runsuite + testapi + testAutomata + testC14N + testchar + testdict + testHTML + testModule + testlimits + testReader + testrecurse + testRegexp + testRelax + testSAX + testSchemas + testURI + testXPath + ) + foreach(TEST ${TESTS}) + add_executable(${TEST} ${TEST}.c) + target_link_libraries(${TEST} LibXml2) + endforeach() + if(EXISTS ${LIBXML2_XMLCONF_WORKING_DIR}/xmlconf/xmlconf.xml) + add_test(NAME runxmlconf COMMAND runxmlconf WORKING_DIRECTORY ${LIBXML2_XMLCONF_WORKING_DIR}) + endif() + if(NOT WIN32) + add_test(NAME testapi COMMAND testapi) + endif() + add_test(NAME testchar COMMAND testchar) + add_test(NAME testdict COMMAND testdict) + add_test(NAME testrecurse COMMAND testrecurse WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) + if(Threads_FOUND) + set( + TESTS_THREADS + runtest + testThreads + ) + foreach(TEST ${TESTS_THREADS}) + add_executable(${TEST} ${TEST}.c) + if(WIN32) + target_compile_definitions(${TEST} PRIVATE HAVE_WIN32_THREADS) + endif() + target_link_libraries(${TEST} LibXml2 Threads::Threads) + endforeach() + add_test(NAME runtest COMMAND runtest --out ${CMAKE_CURRENT_BINARY_DIR} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) + add_test(NAME testThreads COMMAND testThreads WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) + endif() endif() if(LIBXML2_WITH_PYTHON) - execute_process( - COMMAND - ${Python_EXECUTABLE} - ${CMAKE_CURRENT_SOURCE_DIR}/python/generator.py - ${CMAKE_CURRENT_SOURCE_DIR}/doc/libxml2-api.xml - ${CMAKE_CURRENT_SOURCE_DIR}/python/libxml2-python-api.xml - WORKING_DIRECTORY - ${CMAKE_CURRENT_BINARY_DIR} - ) - file(READ python/libxml.py LIBXML_PY) - file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/libxml2.py.in "${LIBXML_PY}") - file(READ ${CMAKE_CURRENT_BINARY_DIR}/libxml2class.py LIBXML2CLASS_PY) - file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/libxml2.py.in "${LIBXML2CLASS_PY}") - configure_file(${CMAKE_CURRENT_BINARY_DIR}/libxml2.py.in libxml2.py COPYONLY) - add_library( - LibXml2Mod - libxml2-py.c - libxml2-py.h - python/libxml.c - python/libxml_wrap.h - python/types.c - ) - target_include_directories( - LibXml2Mod - PUBLIC - $ - ) - target_link_libraries(LibXml2Mod LibXml2 Python::Python) - set_target_properties( - LibXml2Mod - PROPERTIES - IMPORT_PREFIX lib - OUTPUT_NAME xml2mod - PREFIX lib - VERSION ${PROJECT_VERSION} - ) - install( - TARGETS LibXml2Mod - ARCHIVE DESTINATION ${LIBXML2_PYTHON_INSTALL_DIR} COMPONENT development - LIBRARY DESTINATION ${LIBXML2_PYTHON_INSTALL_DIR} COMPONENT runtime NAMELINK_COMPONENT development - RUNTIME DESTINATION ${LIBXML2_PYTHON_INSTALL_DIR} COMPONENT runtime - ) - if(MSVC AND BUILD_SHARED_LIBS) - install(FILES $ DESTINATION ${LIBXML2_PYTHON_INSTALL_DIR} CONFIGURATIONS Debug RelWithDebInfo COMPONENT debug) - endif() - install(FILES python/drv_libxml2.py DESTINATION ${LIBXML2_PYTHON_INSTALL_DIR} COMPONENT runtime) - install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libxml2.py DESTINATION ${LIBXML2_PYTHON_INSTALL_DIR} COMPONENT runtime) + execute_process( + COMMAND + ${Python_EXECUTABLE} + ${CMAKE_CURRENT_SOURCE_DIR}/python/generator.py + ${CMAKE_CURRENT_SOURCE_DIR}/doc/libxml2-api.xml + ${CMAKE_CURRENT_SOURCE_DIR}/python/libxml2-python-api.xml + WORKING_DIRECTORY + ${CMAKE_CURRENT_BINARY_DIR} + ) + file(READ python/libxml.py LIBXML_PY) + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/libxml2.py.in "${LIBXML_PY}") + file(READ ${CMAKE_CURRENT_BINARY_DIR}/libxml2class.py LIBXML2CLASS_PY) + file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/libxml2.py.in "${LIBXML2CLASS_PY}") + configure_file(${CMAKE_CURRENT_BINARY_DIR}/libxml2.py.in libxml2.py COPYONLY) + add_library( + LibXml2Mod + libxml2-py.c + libxml2-py.h + python/libxml.c + python/libxml_wrap.h + python/types.c + ) + target_include_directories( + LibXml2Mod + PUBLIC + $ + ) + target_link_libraries(LibXml2Mod LibXml2 Python::Python) + set_target_properties( + LibXml2Mod + PROPERTIES + IMPORT_PREFIX lib + OUTPUT_NAME xml2mod + PREFIX lib + VERSION ${PROJECT_VERSION} + ) + install( + TARGETS LibXml2Mod + ARCHIVE DESTINATION ${LIBXML2_PYTHON_INSTALL_DIR} COMPONENT development + LIBRARY DESTINATION ${LIBXML2_PYTHON_INSTALL_DIR} COMPONENT runtime NAMELINK_COMPONENT development + RUNTIME DESTINATION ${LIBXML2_PYTHON_INSTALL_DIR} COMPONENT runtime + ) + if(MSVC AND BUILD_SHARED_LIBS) + install(FILES $ DESTINATION ${LIBXML2_PYTHON_INSTALL_DIR} CONFIGURATIONS Debug RelWithDebInfo COMPONENT debug) + endif() + install(FILES python/drv_libxml2.py DESTINATION ${LIBXML2_PYTHON_INSTALL_DIR} COMPONENT runtime) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libxml2.py DESTINATION ${LIBXML2_PYTHON_INSTALL_DIR} COMPONENT runtime) endif() #install(FILES libxml.3 DESTINATION ${CMAKE_INSTALL_MANDIR}/man3 COMPONENT documentation) @@ -667,81 +674,84 @@ endif() set(EXPORT_DEPENDENCIES_FILE ${CMAKE_CURRENT_BINARY_DIR}/libxml2-exports-dependencies.cmake) file(WRITE ${EXPORT_DEPENDENCIES_FILE} "include(CMakeFindDependencyMacro)\r\n" - "set(${PROJECT_NAME}_IMPORT_PREFIX \${_IMPORT_PREFIX})\r\n") -get_target_property(_xml2_type LibXml2 TYPE) -if (WITH_ZLIB) - if (TARGET z) - get_target_property(_zlib_type z TYPE) - get_target_property(_is_zlib_found_by_config z IMPORTED_CONFIGURATIONS) - if (_is_zlib_found_by_config) - # Make sure that the ZLIB_DIR is absolute before it gets used in a configuration file for libxml2. - get_filename_component(_ABS_ZLIB_DIR "${ZLIB_DIR}" ABSOLUTE) - endif() - else () - set(_zlib_type SHARED_LIBRARY) - endif () + "set(${PROJECT_NAME}_IMPORT_PREFIX \${_IMPORT_PREFIX})\r\n") +if(LIBXML2_WITH_ZLIB) + if (TARGET z) + if (ZLIB_CONFIG_MODE) + # Make sure that the ZLIB_DIR is absolute before it gets used in a configuration file for libxml2. + get_filename_component(_ABS_ZLIB_DIR "${ZLIB_DIR}" ABSOLUTE) + endif() + endif () + file(APPEND ${EXPORT_DEPENDENCIES_FILE} "if(LIBXML2_WITH_ZLIB)\r\n") if (EXISTS "${_ABS_ZLIB_DIR}") - file(APPEND ${EXPORT_DEPENDENCIES_FILE} "set(ZLIB_DIR \"${_ABS_ZLIB_DIR}\")\r\n") + file(APPEND ${EXPORT_DEPENDENCIES_FILE} " set(ZLIB_DIR \"${_ABS_ZLIB_DIR}\")\r\n") # The find_dependency command doesn't appear to use CONFIG mode of find_package as a backup search mode. # This means if we think we have found zlib for this library via configuration files then we force this # for the libxml2 find_dependency command. set(_FIND_ZLIB_BY_CONFIG " CONFIG") endif () - if (_zlib_type STREQUAL "STATIC_LIBRARY" AND _xml2_type STREQUAL "SHARED_LIBRARY") - file(APPEND ${EXPORT_DEPENDENCIES_FILE} "add_library(zlib INTERFACE IMPORTED)\r\n") - else () - file(APPEND ${EXPORT_DEPENDENCIES_FILE} "set(ZLIB_FIND_SYSTEM ${ZLIB_FIND_SYSTEM})\r\nfind_dependency(ZLIB ${ZLIB_VERSION}${_FIND_ZLIB_BY_CONFIG})\r\n") - endif () + message(STATUS "BUILD_SHARED_LIBS: ${BUILD_SHARED_LIBS}") + message(STATUS "ZLIB_LINK_TYPE: ${ZLIB_LINK_TYPE}") + if(ZLIB_LINK_TYPE STREQUAL "PUBLIC") + file(APPEND ${EXPORT_DEPENDENCIES_FILE} " set(ZLIB_FIND_SYSTEM ${ZLIB_FIND_SYSTEM})\r\nfind_dependency(ZLIB ${ZLIB_VERSION}${_FIND_ZLIB_BY_CONFIG})\r\n") + endif () + file(APPEND ${EXPORT_DEPENDENCIES_FILE} "endif()\r\n") endif() file(APPEND ${EXPORT_DEPENDENCIES_FILE} "set(_IMPORT_PREFIX \${${PROJECT_NAME}_IMPORT_PREFIX})\r\n") configure_file(libxml2-config.in.cmake libxml2-config.cmake @ONLY) + +if (MSVC) + set(PACKAGE_CONFIG_DIR ${PROJECT_NAME}-${PROJECT_VERSION}/CMake) +else () + set(PACKAGE_CONFIG_DIR lib/cmake/${PROJECT_NAME}-${PROJECT_VERSION}) +endif() #configure_package_config_file( -# libxml2-config.cmake.cmake.in libxml2-config.cmake -# INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/libxml2-${PROJECT_VERSION} +# libxml2-config.cmake.cmake.in libxml2-config.cmake +# INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/libxml2-${PROJECT_VERSION} #) #install(EXPORT libxml2-exports DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/libxml2-${PROJECT_VERSION}) install( - EXPORT libxml2-exports - DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/libxml2-${PROJECT_VERSION} -# NAMESPACE LibXml2:: -# FILE libxml2-config.cmake - COMPONENT development + EXPORT libxml2-exports + DESTINATION ${PACKAGE_CONFIG_DIR} +# NAMESPACE LibXml2:: +# FILE libxml2-config.cmake + COMPONENT development ) export(EXPORT libxml2-exports) install( - FILES ${CMAKE_CURRENT_BINARY_DIR}/libxml2-config.cmake - DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/libxml2-${PROJECT_VERSION} - COMPONENT development + FILES ${CMAKE_CURRENT_BINARY_DIR}/libxml2-config.cmake + DESTINATION ${PACKAGE_CONFIG_DIR} + COMPONENT development ) write_basic_package_version_file( - ${CMAKE_CURRENT_BINARY_DIR}/libxml2-exports-version.cmake - VERSION ${PROJECT_VERSION} - COMPATIBILITY ExactVersion + ${CMAKE_CURRENT_BINARY_DIR}/libxml2-exports-version.cmake + VERSION ${PROJECT_VERSION} + COMPATIBILITY ExactVersion ) install( - FILES ${CMAKE_CURRENT_BINARY_DIR}/libxml2-exports-version.cmake ${EXPORT_DEPENDENCIES_FILE} - DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/libxml2-${PROJECT_VERSION} - COMPONENT development + FILES ${CMAKE_CURRENT_BINARY_DIR}/libxml2-exports-version.cmake ${EXPORT_DEPENDENCIES_FILE} + DESTINATION ${PACKAGE_CONFIG_DIR} + COMPONENT development ) configure_file(include/libxml/xmlversion.h.in libxml/xmlversion.h) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libxml/xmlversion.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/libxml2/libxml COMPONENT development) if(MSVC) - configure_file(include/libxml/xmlwin32version.h.in libxml/xmlwin32version.h) - install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libxml/xmlwin32version.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/libxml2/libxml COMPONENT development) + configure_file(include/libxml/xmlwin32version.h.in libxml/xmlwin32version.h) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libxml/xmlwin32version.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/libxml2/libxml COMPONENT development) endif() if(LIBXML2_WITH_PYTHON) - set(prefix "${CMAKE_INSTALL_PREFIX}") - configure_file(python/setup.py.in setup.py @ONLY) + set(prefix "${CMAKE_INSTALL_PREFIX}") + configure_file(python/setup.py.in setup.py @ONLY) endif() set(XML_INCLUDEDIR "-I\${includedir}/libxml2") diff --git a/libxml2-config.in.cmake b/libxml2-config.in.cmake index ab5b778..07f49b1 100644 --- a/libxml2-config.in.cmake +++ b/libxml2-config.in.cmake @@ -33,5 +33,3 @@ if(NOT LIBXML2_SHARED) endif() include("${CMAKE_CURRENT_LIST_DIR}/libxml2-exports.cmake") -add_library(xml2 ALIAS LibXml2) -