-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[lldb] build: cleanup extraneous include paths #117615
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
Conversation
@llvm/pr-subscribers-lldb Author: Saleem Abdulrasool (compnerd) ChangesThe Add a workaround to support CONFIG mode search which avoids this need. Additionally, clean up some unnecessary include paths. The use of Full diff: https://github.com/llvm/llvm-project/pull/117615.diff 1 Files Affected:
diff --git a/lldb/cmake/modules/LLDBConfig.cmake b/lldb/cmake/modules/LLDBConfig.cmake
index 93ccd9c479c2b8..ba3ce6c444f887 100644
--- a/lldb/cmake/modules/LLDBConfig.cmake
+++ b/lldb/cmake/modules/LLDBConfig.cmake
@@ -57,7 +57,17 @@ add_optional_dependency(LLDB_ENABLE_CURSES "Enable curses support in LLDB" Curse
add_optional_dependency(LLDB_ENABLE_LZMA "Enable LZMA compression support in LLDB" LibLZMA LIBLZMA_FOUND)
add_optional_dependency(LLDB_ENABLE_LUA "Enable Lua scripting support in LLDB" LuaAndSwig LUAANDSWIG_FOUND)
add_optional_dependency(LLDB_ENABLE_PYTHON "Enable Python scripting support in LLDB" PythonAndSwig PYTHONANDSWIG_FOUND)
-add_optional_dependency(LLDB_ENABLE_LIBXML2 "Enable Libxml 2 support in LLDB" LibXml2 LIBXML2_FOUND VERSION 2.8)
+# LibXml2 is required if LLDB_ENABLE_LIBXML2 is ON or AUTO. The LibXml2 package
+# search is not setup properly to support the CONFIG mode search. Furthermore,
+# in CONFIG mode, we cannot specify the version as that is an exact match. As a
+# mitigation, perform a CONFIG mode search for LibXml2 if LLDB_ENABLE_LIBXML2
+# is ON or AUTO, and fallback to the old path if not found.
+if(LLDB_ENABLE_LIBXML2 OR "${LLDB_ENABLE_LIBXML2}" STREQUAL "AUTO")
+ find_package(LibXml2 CONFIG)
+ if(NOT TARGET LibXml2::LibXml2)
+ add_optional_dependency(LLDB_ENABLE_LIBXML2 "Enable Libxml 2 support in LLDB" LibXml2 LIBXML2_FOUND VERSION 2.8)
+ endif()
+endif()
add_optional_dependency(LLDB_ENABLE_FBSDVMCORE "Enable libfbsdvmcore support in LLDB" FBSDVMCore FBSDVMCore_FOUND QUIET)
option(LLDB_USE_ENTITLEMENTS "When codesigning, use entitlements if available" ON)
@@ -239,10 +249,6 @@ if (LLDB_ENABLE_LZMA)
include_directories(${LIBLZMA_INCLUDE_DIRS})
endif()
-if (LLDB_ENABLE_LIBXML2)
- include_directories(${LIBXML2_INCLUDE_DIR})
-endif()
-
include_directories(BEFORE
${CMAKE_CURRENT_BINARY_DIR}/include
${CMAKE_CURRENT_SOURCE_DIR}/include
@@ -283,7 +289,6 @@ if (APPLE)
find_library(FOUNDATION_LIBRARY Foundation)
find_library(CORE_FOUNDATION_LIBRARY CoreFoundation)
find_library(SECURITY_LIBRARY Security)
- include_directories(${LIBXML2_INCLUDE_DIR})
endif()
if( WIN32 AND NOT CYGWIN )
|
Clean up some unnecessary include paths. The use of `LibXml2::LibXml2` with `target_link_libraries` on `libLLDBHost` ensures that the header search path is properly propagated.
I don't have any objections to this. Please update the PR description before landing, it will be used as the commit message. |
Clean up some unnecessary include paths. The use of
LibXml2::LibXml2
with
target_link_libraries
onlibLLDBHost
ensures that the headersearch path is properly propagated.