[Lldb-commits] [lldb] [lldb][cmake] Populate Clang resource dir for CMakeCache (PR #136761)
via lldb-commits
lldb-commits at lists.llvm.org
Tue Apr 22 13:53:09 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-lldb
Author: Chelsea Cassanova (chelcassanova)
<details>
<summary>Changes</summary>
We want to be able to access the Clang resources directory in LLDB shell tests, this commit adds the ability to do this by populating the `CLANG_RESOURCE_DIR` CMake cache variable and adding it to the LLDB lit config.
---
Full diff: https://github.com/llvm/llvm-project/pull/136761.diff
2 Files Affected:
- (modified) lldb/cmake/modules/LLDBFramework.cmake (+3-1)
- (modified) lldb/test/Shell/lit.site.cfg.py.in (+1)
``````````diff
diff --git a/lldb/cmake/modules/LLDBFramework.cmake b/lldb/cmake/modules/LLDBFramework.cmake
index 471aeaaad3c0d..2fcc8f2f36f29 100644
--- a/lldb/cmake/modules/LLDBFramework.cmake
+++ b/lldb/cmake/modules/LLDBFramework.cmake
@@ -121,7 +121,7 @@ add_custom_command(TARGET liblldb POST_BUILD
if(NOT APPLE_EMBEDDED)
if (TARGET clang-resource-headers)
add_dependencies(liblldb clang-resource-headers)
- set(clang_resource_headers_dir $<TARGET_PROPERTY:clang-resource-headers,INTERFACE_INCLUDE_DIRECTORIES>)
+ get_target_property(clang_resource_headers_dir clang-resource-headers INTERFACE_INCLUDE_DIRECTORIES)
else()
set(clang_resource_headers_dir ${LLDB_EXTERNAL_CLANG_RESOURCE_DIR}/include)
if(NOT EXISTS ${clang_resource_headers_dir})
@@ -135,6 +135,8 @@ if(NOT APPLE_EMBEDDED)
$<TARGET_FILE_DIR:liblldb>/Resources/Clang/include
COMMENT "LLDB.framework: copy clang vendor-specific headers"
)
+
+ set(CLANG_RESOURCE_DIR ${clang_resource_headers_dir} CACHE FILEPATH "")
endif()
# Add an rpath pointing to the directory where LLDB.framework is installed.
diff --git a/lldb/test/Shell/lit.site.cfg.py.in b/lldb/test/Shell/lit.site.cfg.py.in
index 31a6d68618b77..7e03938b12b23 100644
--- a/lldb/test/Shell/lit.site.cfg.py.in
+++ b/lldb/test/Shell/lit.site.cfg.py.in
@@ -35,6 +35,7 @@ config.llvm_use_sanitizer = "@LLVM_USE_SANITIZER@"
# The shell tests use their own module caches.
config.lldb_module_cache = os.path.join("@LLDB_TEST_MODULE_CACHE_LLDB@", "lldb-shell")
config.clang_module_cache = os.path.join("@LLDB_TEST_MODULE_CACHE_CLANG@", "lldb-shell")
+config.clang_resource_dir = os.path.join("@CLANG_RESOURCE_DIR@")
import lit.llvm
lit.llvm.initialize(lit_config, config)
``````````
</details>
https://github.com/llvm/llvm-project/pull/136761
More information about the lldb-commits
mailing list