-
Notifications
You must be signed in to change notification settings - Fork 6.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[libxml2] Add link libraries for target LibXml2::LibXml2 #14478
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think still LIBXML2_LIBRARIES is not populated correctly.
The missing libraries should first be added to LIBXML2_LIBRARIES variable
and then target LibXml2::LibXml2 should link with this variable.
Due to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now it's broken on macOS.
This is my proposition:
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
list(APPEND LIBXML2_LIBRARIES m)
else()
list(APPEND LIBXML2_LIBRARIES ${ICONV_LIBRARIES} ${CHARSET_LIBRARIES} ${LIBLZMA_LIBRARIES} ${ZLIB_LIBRARIES})
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
list(APPEND LIBXML2_LIBRARIES ws2_32)
endif()
endif()
if(TARGET LibXml2::LibXml2)
target_link_libraries(LibXml2::LibXml2 INTERFACE ${LIBXML2_LIBRARIES})
endif()
if(CMAKE_SYSTEM_NAME STREQUAL "Windows") | ||
list(APPEND LIBXML2_LIBRARIES ws2_32) | ||
if(TARGET LibXml2::LibXml2) | ||
target_link_libraries(LibXml2::LibXml2 INTERFACE ${LIBXML2_LIBRARIES}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Simply no. This is linking itself. LIBXML2_LIBRARIES is not empty after the find_package
call but contains the libxml2 library.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I think I agree with this; could we switch to the old code, but add target_link_libraries
below the second list(APPEND
?
Replaced by #14588. |
Describe the pull request
Target
LibXml2::LibXml2
is not linked against all necessary libraries in vcpkg-cmake-wrapper.cmake. TargetLibXml2::LibXml2
should link withIconv
,Charset
,lzma
,zlib
,ws2_32
(windows only) libraries.