[llvm-branch-commits] [runtimes] Allow building against an installed LLVM tree (PR #86209)

Alexander Richardson via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Fri Apr 12 14:37:48 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)
----------------
arichardson wrote:

Sorry for the delay here, was waiting to land the dependent PRs. Updated now.

https://github.com/llvm/llvm-project/pull/86209


More information about the llvm-branch-commits mailing list