https://github.com/chelcassanova created https://github.com/llvm/llvm-project/pull/136761
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. >From c7d22d4bb27eb2cd0e7c12b152a47d9c59714ab2 Mon Sep 17 00:00:00 2001 From: Chelsea Cassanova <chelsea_cassan...@apple.com> Date: Tue, 22 Apr 2025 13:28:04 -0700 Subject: [PATCH] [lldb][cmake] Populate Clang resource dir for CMakeCache 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. --- lldb/cmake/modules/LLDBFramework.cmake | 4 +++- lldb/test/Shell/lit.site.cfg.py.in | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) 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) _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits