forked from osmocom/wireshark
FindXml2: use pkg-config to find libxml2 dependencies
On UNIX, when statically built, libxml2 can depends on other libraries such as lzma. These dependencies are already retrieved through pkg-config so append them to LIBXML2_LIBRARIES otherwise static build will fail Change-Id: I362064969488ec53042aa323eadb54fef026d8a5 Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com> Reviewed-on: https://code.wireshark.org/review/32968 Petri-Dish: Guy Harris <guy@alum.mit.edu> Tested-by: Petri Dish Buildbot Reviewed-by: Peter Wu <peter@lekensteyn.nl>
This commit is contained in:
parent
b641febb1e
commit
580098d875
|
@ -106,10 +106,17 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibXml2
|
|||
|
||||
mark_as_advanced(LIBXML2_INCLUDE_DIR LIBXML2_LIBRARY LIBXML2_XMLLINT_EXECUTABLE)
|
||||
|
||||
if(LibXml2_FOUND AND NOT TARGET LibXml2::LibXml2)
|
||||
add_library(LibXml2::LibXml2 UNKNOWN IMPORTED)
|
||||
set_target_properties(LibXml2::LibXml2 PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${LIBXML2_INCLUDE_DIRS}")
|
||||
set_property(TARGET LibXml2::LibXml2 APPEND PROPERTY IMPORTED_LOCATION "${LIBXML2_LIBRARY}")
|
||||
if(LibXml2_FOUND)
|
||||
# Include transitive dependencies for static linking.
|
||||
if(UNIX AND CMAKE_FIND_LIBRARY_SUFFIXES STREQUAL ".a")
|
||||
list(APPEND LIBXML2_LIBRARIES ${PC_LIBXML_LIBRARIES})
|
||||
endif()
|
||||
|
||||
if (NOT TARGET LibXml2::LibXml2)
|
||||
add_library(LibXml2::LibXml2 UNKNOWN IMPORTED)
|
||||
set_target_properties(LibXml2::LibXml2 PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${LIBXML2_INCLUDE_DIRS}")
|
||||
set_property(TARGET LibXml2::LibXml2 APPEND PROPERTY IMPORTED_LOCATION "${LIBXML2_LIBRARY}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
AddWSWinDLLS(LibXml2 LIBXML2_HINTS "libxml2*" "lzma*")
|
||||
|
|
Loading…
Reference in New Issue