@@ -239,23 +239,6 @@ foreach(entry ${runtimes})
239239endforeach ()
240240
241241if (LLVM_INCLUDE_TESTS)
242- # If built with the runtimes build (rooted at runtimes/CMakeLists.txt), we
243- # won't have llvm-lit. If built with the bootstrapping build (rooted at
244- # llvm/CMakeLists.txt), the top-level llvm CMake invocation already generated
245- # the llvm-lit script.
246- if (NOT HAVE_LLVM_LIT)
247- # Add lit before adding any runtimes since their CMake tests configuration
248- # might depend on lit being present.
249- set (LLVM_LIT_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR} /bin)
250- add_subdirectory (${LLVM_MAIN_SRC_DIR} /utils/llvm-lit
251- ${CMAKE_CURRENT_BINARY_DIR} /llvm-lit)
252- # Ensure that the testsuites use the local lit rather than
253- # ${LLVM_INSTALL_DIR}/bin/llvm-lit (which may not exist if LLVM_BINARY_DIR
254- # points at an installed LLVM tree rather than a build tree).
255- get_llvm_lit_path(_base_dir _file_name)
256- set (LLVM_EXTERNAL_LIT "${_base_dir} /${_file_name} " CACHE STRING "Command used to spawn lit" FORCE)
257- endif ()
258-
259242 set (LIT_ARGS_DEFAULT "-sv --show-xfail --show-unsupported" )
260243 if (MSVC OR XCODE)
261244 set (LIT_ARGS_DEFAULT "${LIT_ARGS_DEFAULT} --no-progress-bar" )
@@ -289,6 +272,14 @@ if(LLVM_INCLUDE_TESTS)
289272 # and we know the total set of lit testsuites.
290273 umbrella_lit_testsuite_end(check-runtimes)
291274
275+ if (NOT HAVE_LLVM_LIT)
276+ # If built by manually invoking cmake on this directory, we don't have
277+ # llvm-lit. If invoked via llvm/runtimes, the toplevel llvm cmake
278+ # invocation already generated the llvm-lit script.
279+ add_subdirectory (${LLVM_MAIN_SRC_DIR} /utils/llvm-lit
280+ ${CMAKE_CURRENT_BINARY_DIR} /llvm-lit)
281+ endif ()
282+
292283 get_property (LLVM_RUNTIMES_LIT_TESTSUITES GLOBAL PROPERTY LLVM_RUNTIMES_LIT_TESTSUITES)
293284 string (REPLACE ";" "\n " LLVM_RUNTIMES_LIT_TESTSUITES "${LLVM_RUNTIMES_LIT_TESTSUITES} " )
294285 file (WRITE ${CMAKE_CURRENT_BINARY_DIR} /lit.tests ${LLVM_RUNTIMES_LIT_TESTSUITES} )
@@ -318,10 +309,10 @@ if(SUB_COMPONENTS)
318309 if (LLVM_RUNTIMES_TARGET)
319310 configure_file (
320311 ${CMAKE_CURRENT_SOURCE_DIR} /Components.cmake.in
321- ${CMAKE_CURRENT_BINARY_DIR } /runtimes/${LLVM_RUNTIMES_TARGET} /Components.cmake)
312+ ${LLVM_BINARY_DIR } /runtimes/${LLVM_RUNTIMES_TARGET} /Components.cmake)
322313 else ()
323314 configure_file (
324315 ${CMAKE_CURRENT_SOURCE_DIR} /Components.cmake.in
325- ${CMAKE_CURRENT_BINARY_DIR } /runtimes/Components.cmake)
316+ ${LLVM_BINARY_DIR } /runtimes/Components.cmake)
326317 endif ()
327318endif ()
0 commit comments