Skip to content

Commit b8fec72

Browse files
committed
[lldb][cmake] Add clang resource dir to LLDB shell tests config
We want to be able to access the Clang resources directory in LLDB shell tests, this commit adds the ability to do this by adding the `CLANG_RESOURCE_DIR` CMake variable to the config for LLDB lit tests
1 parent 6f1adbd commit b8fec72

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

lldb/cmake/modules/LLDBConfig.cmake

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,17 @@ else ()
181181
endif ()
182182
include_directories("${CMAKE_CURRENT_BINARY_DIR}/../clang/include")
183183

184+
if(LLDB_BUILT_STANDALONE)
185+
if (TARGET clang-resource-headers)
186+
get_target_property(CLANG_RESOURCE_DIR clang-resource-headers INTERFACE_INCLUDE_DIRECTORIES)
187+
set(CLANG_RESOURCE_DIR "${CLANG_RESOURCE_DIR}/..")
188+
else()
189+
set(CLANG_RESOURCE_DIR "${LLDB_EXTERNAL_CLANG_RESOURCE_DIR}")
190+
endif()
191+
else()
192+
get_clang_resource_dir(CLANG_RESOURCE_DIR PREFIX "${CMAKE_BINARY_DIR}")
193+
endif()
194+
184195
# GCC silently accepts any -Wno-<foo> option, but warns about those options
185196
# being unrecognized only if the compilation triggers other warnings to be
186197
# printed. Therefore, check for whether the compiler supports options in the

lldb/test/Shell/lit.site.cfg.py.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ config.llvm_use_sanitizer = "@LLVM_USE_SANITIZER@"
3535
# The shell tests use their own module caches.
3636
config.lldb_module_cache = os.path.join("@LLDB_TEST_MODULE_CACHE_LLDB@", "lldb-shell")
3737
config.clang_module_cache = os.path.join("@LLDB_TEST_MODULE_CACHE_CLANG@", "lldb-shell")
38+
config.clang_resource_dir = os.path.join("@CLANG_RESOURCE_DIR@")
3839

3940
import lit.llvm
4041
lit.llvm.initialize(lit_config, config)

0 commit comments

Comments
 (0)