From eb68a0ab5ee8a8354f1539fb00409f027a7137b2 Mon Sep 17 00:00:00 2001 From: Louis Dionne Date: Mon, 29 Jun 2020 11:51:15 -0400 Subject: [PATCH] [libc++] Do not try creating llvm-lit when LIBCXX_INCLUDE_TESTS is OFF in the standalone build Doing so doesn't work reliably, since it relies on LLVM_* implementation detail variables being set. Furthermore, since we rely on the lit.site.cfg being generated, running the tests requires LIBCXX_INCLUDE_TESTS=ON anyway. --- libcxx/CMakeLists.txt | 30 ++++++++++-------------------- 1 file changed, 10 insertions(+), 20 deletions(-) diff --git a/libcxx/CMakeLists.txt b/libcxx/CMakeLists.txt index 2fdb9b370c4c..9fb4e40a014a 100644 --- a/libcxx/CMakeLists.txt +++ b/libcxx/CMakeLists.txt @@ -916,28 +916,18 @@ if (LIBCXX_INCLUDE_BENCHMARKS) add_subdirectory(benchmarks) endif() -# Create the lit.site.cfg file even when LIBCXX_INCLUDE_TESTS is OFF or -# LLVM_FOUND is OFF. This allows users to run the tests manually using -# LIT without requiring a full LLVM checkout. -# -# However, since some submission systems strip test/ subdirectories, check for -# it before adding it. - -if(IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/test") - add_subdirectory(test) -endif() if (LIBCXX_INCLUDE_TESTS) + add_subdirectory(test) add_subdirectory(lib/abi) -endif() - -if (LIBCXX_STANDALONE_BUILD AND EXISTS "${LLVM_MAIN_SRC_DIR}/utils/llvm-lit") - include(AddLLVM) # for get_llvm_lit_path - # Make sure the llvm-lit script is generated into the bin directory, and do - # it after adding all tests, since the generated script will only work - # correctly discovered tests against test locations from the source tree that - # have already been discovered. - add_subdirectory(${LLVM_MAIN_SRC_DIR}/utils/llvm-lit - ${CMAKE_CURRENT_BINARY_DIR}/llvm-lit) + if (LIBCXX_STANDALONE_BUILD) + include(AddLLVM) # for get_llvm_lit_path + # Make sure the llvm-lit script is generated into the bin directory, and + # do it after adding all tests, since the generated script will only work + # correctly discovered tests against test locations from the source tree + # that have already been discovered. + add_subdirectory(${LLVM_MAIN_SRC_DIR}/utils/llvm-lit + ${CMAKE_CURRENT_BINARY_DIR}/llvm-lit) + endif() endif() if (LIBCXX_INCLUDE_DOCS)