mirror of
https://gitlab.gnome.org/GNOME/libxml2
synced 2025-03-28 21:33:13 +00:00
Configure pkgconfig, xml2-config, and xml2Conf.sh file
This commit is contained in:
parent
79301d3d5e
commit
296ab61e1c
@ -417,6 +417,7 @@ add_library(LibXml2 ${LIBXML2_HDRS} ${LIBXML2_SRCS})
|
||||
|
||||
if(NOT BUILD_SHARED_LIBS)
|
||||
target_compile_definitions(LibXml2 INTERFACE LIBXML_STATIC)
|
||||
set(XML_CFLAGS "-DLIBXML_STATIC")
|
||||
endif()
|
||||
|
||||
if(LIBXML2_WITH_THREADS)
|
||||
@ -436,38 +437,53 @@ target_include_directories(
|
||||
|
||||
if(HAVE_DLOPEN)
|
||||
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")
|
||||
endif()
|
||||
|
||||
if(UNIX)
|
||||
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")
|
||||
endif()
|
||||
|
||||
if(LIBXML2_WITH_ICONV)
|
||||
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::i18n)
|
||||
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")
|
||||
endif()
|
||||
|
||||
if(LIBXML2_WITH_THREADS)
|
||||
target_link_libraries(LibXml2 PRIVATE Threads::Threads)
|
||||
set(THREAD_LIBS ${CMAKE_THREAD_LIBS_INIT})
|
||||
endif()
|
||||
|
||||
if(LIBXML2_WITH_ZLIB)
|
||||
target_link_libraries(LibXml2 PRIVATE ZLIB::ZLIB)
|
||||
set(Z_LIBS "-lz")
|
||||
endif()
|
||||
|
||||
set_target_properties(
|
||||
@ -685,6 +701,30 @@ if(LIBXML2_WITH_PYTHON)
|
||||
configure_file(python/setup.py.in setup.py @ONLY)
|
||||
endif()
|
||||
|
||||
set(XML_INCLUDEDIR "-I\${includedir}/libxml2")
|
||||
set(XML_LIBDIR "-L\${libdir}")
|
||||
set(XML_LIBS "-lxml2")
|
||||
set(XML_PRIVATE_LIBS "${Z_LIBS} ${LZMA_LIBS} ${THREAD_LIBS} ${ICONV_LIBS} ${ICU_LIBS} ${M_LIBS}")
|
||||
|
||||
file(RELATIVE_PATH PACKAGE_RELATIVE_PATH "${CMAKE_INSTALL_FULL_LIBDIR}/pkgconfig" "${CMAKE_INSTALL_PREFIX}")
|
||||
string(REGEX REPLACE "/$" "" PACKAGE_RELATIVE_PATH "${PACKAGE_RELATIVE_PATH}")
|
||||
|
||||
set(prefix "\${pcfiledir}/${PACKAGE_RELATIVE_PATH}")
|
||||
set(exec_prefix "\${prefix}")
|
||||
set(libdir "\${prefix}/${CMAKE_INSTALL_LIBDIR}")
|
||||
set(includedir "\${prefix}/${CMAKE_INSTALL_INCLUDEDIR}")
|
||||
configure_file(libxml-2.0.pc.in libxml-2.0.pc @ONLY)
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libxml-2.0.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig COMPONENT development)
|
||||
|
||||
set(prefix "\$(cd \"\$(dirname \"\$0\")\"; pwd -P)/..")
|
||||
configure_file(xml2-config.in xml2-config @ONLY)
|
||||
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/xml2-config DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT development)
|
||||
|
||||
set(XML_INCLUDEDIR "-I${CMAKE_INSTALL_FULL_INCLUDEDIR}/libxml2")
|
||||
set(XML_LIBDIR "-L${CMAKE_INSTALL_FULL_LIBDIR}")
|
||||
configure_file(xml2Conf.sh.in xml2Conf.sh @ONLY)
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/xml2Conf.sh DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT development)
|
||||
|
||||
set(CPACK_COMPONENT_DEVELOPMENT_DEPENDS runtime)
|
||||
set(CPACK_COMPONENT_PROGRAMS_DEPENDS runtime)
|
||||
set(CPACK_DEB_COMPONENT_INSTALL ON)
|
||||
|
Loading…
x
Reference in New Issue
Block a user