llvm/lld/test/CMakeLists.txt
Sam McCall 57ee624d79 [cmake] Provide CURRENT_TOOLS_DIR centrally, replacing CLANG_TOOLS_DIR
CLANG_TOOLS_DIR holds the the current bin/ directory, maybe with a %(build_mode)
placeholder. It is used to add the just-built binaries to $PATH for lit tests.
In most cases it equals LLVM_TOOLS_DIR, which is used for the same purpose.
But for a standalone build of clang, CLANG_TOOLS_DIR points at the build tree
and LLVM_TOOLS_DIR points at the provided LLVM binaries.

Currently CLANG_TOOLS_DIR is set in clang/test/, clang-tools-extra/test/, and
other things always built with clang. This is a few cryptic lines of CMake in
each place. Meanwhile LLVM_TOOLS_DIR is provided by configure_site_lit_cfg().

This patch moves CLANG_TOOLS_DIR to configure_site_lit_cfg() and renames it:
 - there's nothing clang-specific about the value
 - it will also replace LLD_TOOLS_DIR, LLDB_TOOLS_DIR etc (not in this patch)

It also defines CURRENT_LIBS_DIR. While I removed the last usage of
CLANG_LIBS_DIR in e4cab4e24d, there are LLD_LIBS_DIR usages etc that
may be live, and I'd like to mechanically update them in a followup patch.

Differential Revision: https://reviews.llvm.org/D121763
2022-03-25 20:22:01 +01:00

82 lines
1.7 KiB
CMake

llvm_canonicalize_cmake_booleans(
LLVM_ENABLE_ZLIB
LLVM_ENABLE_LIBXML2
LLD_DEFAULT_LD_LLD_IS_MINGW
LLVM_HAVE_LIBXAR
LLVM_BUILD_EXAMPLES
LLVM_ENABLE_PLUGINS
LLVM_BYE_LINK_INTO_TOOLS
)
configure_lit_site_cfg(
${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.py.in
${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg.py
MAIN_CONFIG
${CMAKE_CURRENT_SOURCE_DIR}/lit.cfg.py
)
configure_lit_site_cfg(
${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.site.cfg.py.in
${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg.py
MAIN_CONFIG
${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.cfg.py
)
set(LLD_TEST_DEPS lld)
if (NOT LLD_BUILT_STANDALONE)
list(APPEND LLD_TEST_DEPS
FileCheck
count
dsymutil
llc
llvm-ar
llvm-as
llvm-bcanalyzer
llvm-config
llvm-cvtres
llvm-dis
llvm-dwarfdump
llvm-lib
llvm-lipo
llvm-mc
llvm-nm
llvm-objcopy
llvm-objdump
llvm-otool
llvm-pdbutil
llvm-profdata
llvm-readelf
llvm-readobj
llvm-strip
llvm-symbolizer
not
obj2yaml
opt
split-file
yaml2obj
)
if (NOT WIN32 AND LLVM_BUILD_EXAMPLES)
list(APPEND LLD_TEST_DEPS
Bye
)
endif()
endif()
add_lit_testsuite(check-lld "Running lld test suite"
${CMAKE_CURRENT_BINARY_DIR}
DEPENDS ${LLD_TEST_DEPS}
)
add_custom_target(lld-test-depends DEPENDS ${LLD_TEST_DEPS})
set_target_properties(lld-test-depends PROPERTIES FOLDER "lld tests")
add_lit_testsuites(LLD ${CMAKE_CURRENT_SOURCE_DIR}
DEPENDS ${LLD_TEST_DEPS}
)
set_target_properties(check-lld PROPERTIES FOLDER "lld tests")
# Add a legacy target spelling: lld-test
add_custom_target(lld-test)
add_dependencies(lld-test check-lld)
set_target_properties(lld-test PROPERTIES FOLDER "lld tests")