diff --git a/cmake/modules/AddLLVM.cmake b/cmake/modules/AddLLVM.cmake index 080503ef629..37b3b801912 100644 --- a/cmake/modules/AddLLVM.cmake +++ b/cmake/modules/AddLLVM.cmake @@ -1083,11 +1083,10 @@ function(add_lit_target target comment) if (NOT CMAKE_CFG_INTDIR STREQUAL ".") list(APPEND LIT_ARGS --param build_mode=${CMAKE_CFG_INTDIR}) endif () - if (EXISTS ${LLVM_MAIN_SRC_DIR}/utils/lit/lit.py) - set (LIT_COMMAND "${PYTHON_EXECUTABLE};${LLVM_MAIN_SRC_DIR}/utils/lit/lit.py" - CACHE STRING "Command used to spawn llvm-lit") + if (LLVM_MAIN_SRC_DIR) + set (LIT_COMMAND ${PYTHON_EXECUTABLE} ${LLVM_MAIN_SRC_DIR}/utils/lit/lit.py) else() - find_program(LIT_COMMAND NAMES llvm-lit lit.py lit) + find_program(LIT_COMMAND llvm-lit) endif () list(APPEND LIT_COMMAND ${LIT_ARGS}) foreach(param ${ARG_PARAMS})