[llvm-branch-commits] [runtimes] Allow building against an installed LLVM tree (PR #86209)
Louis Dionne via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Tue Mar 26 06:58:03 PDT 2024
================
@@ -218,6 +218,22 @@ foreach(entry ${runtimes})
endforeach()
if(LLVM_INCLUDE_TESTS)
+ # Add lit if needed before adding any runtimes since their CMake tests
+ # configuration might depend on lit being present.
+ if (NOT HAVE_LLVM_LIT)
+ # If built by manually invoking cmake on this directory, we don't have
+ # llvm-lit. If invoked via llvm/runtimes, the toplevel llvm cmake
+ # invocation already generated the llvm-lit script.
+ set(LLVM_LIT_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/bin)
+ add_subdirectory(${LLVM_MAIN_SRC_DIR}/utils/llvm-lit
+ ${CMAKE_CURRENT_BINARY_DIR}/llvm-lit)
+ # Ensure that the testsuites use the local lit rather than
+ # LLVM_INSTALL_DIR/bin/llvm-lit (which may not exist if LLVM_BINARY_DIR
+ # points at an installed LLVM tree rather than a build tree.
+ get_llvm_lit_path(_base_dir _file_name)
+ set(LLVM_EXTERNAL_LIT "${_base_dir}/${_file_name}" CACHE STRING "Command used to spawn lit" FORCE)
----------------
ldionne wrote:
I don't understand. We *must* have `lit` available since we are in the `runtimes/CMakeLists.txt`? I actually don't understand why the `if (NOT HAVE_LLVM_LIT)` branch is ever taken. Can you shed some light on this?
https://github.com/llvm/llvm-project/pull/86209
More information about the llvm-branch-commits
mailing list