swiftlang / swift-corelibs-foundation

The Foundation Project, providing core utilities, internationalization, and OS independence
swift.org
Apache License 2.0
5.29k stars 1.13k forks source link

[CFXMLInterface] Remove spurious include path. #5114

Closed al45tair closed 1 month ago

al45tair commented 1 month ago

The include path for libxml2 should be being set automatically by CMake because of the target_link_libraries() call; there is no need to add it explicitly.

Additionally, it's a really bad idea if you specify an absolute path...

rdar://137567628

al45tair commented 1 month ago

@swift-ci Please test Linux platform

al45tair commented 1 month ago

@swift-ci Please test Windows platform

al45tair commented 1 month ago

Explanation: The explicit path in the include directories here causes the Swift Static SDK for Linux build to pick up the system copy of libxml2 instead of the one from the sysroot it's building. It shouldn't be necessary to list the path here anyway because target_link_libraries(... LibXml2::LibXml2) should pick up the proper path from the find_package(LibXml2) from the top level CMakeLists.txt. Risk: Low. Fixes a build failure. Original PR: #5101 Reviewed by: @jmschonfeld Resolves: rdar://137567628 Tests: The PR tests should exercise the change to the build system. I have also tested building Swift main on Darwin with this change, and I've tested that it fixes the error when building the Static SDK for Linux.