Skip to content

[CMake] Add BINARY_DIR argument for add_lit_testsuites #144431

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 17, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions llvm/cmake/modules/AddLLVM.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2192,7 +2192,7 @@ endfunction()

function(add_lit_testsuites project directory)
if (NOT LLVM_ENABLE_IDE)
cmake_parse_arguments(ARG "EXCLUDE_FROM_CHECK_ALL" "FOLDER" "PARAMS;DEPENDS;ARGS" ${ARGN})
cmake_parse_arguments(ARG "EXCLUDE_FROM_CHECK_ALL" "FOLDER;BINARY_DIR" "PARAMS;DEPENDS;ARGS" ${ARGN})

if (NOT ARG_FOLDER)
get_subproject_title(subproject_title)
Expand All @@ -2213,13 +2213,18 @@ function(add_lit_testsuites project directory)
endif()

# Create a check- target for the directory.
string(REPLACE ${directory} "" name_slash ${lit_suite})
string(REPLACE "${directory}/" "" name_slash ${lit_suite})
if (name_slash)
set(filter ${name_slash})
string(REPLACE "/" "-" name_slash ${name_slash})
string(REPLACE "\\" "-" name_dashes ${name_slash})
string(TOLOWER "${project}${name_dashes}" name_var)
string(TOLOWER "${project}-${name_dashes}" name_var)
set(lit_args ${lit_suite})
if (ARG_BINARY_DIR)
set(lit_args ${ARG_BINARY_DIR} --filter=${filter})
endif()
add_lit_target("check-${name_var}" "Running lit suite ${lit_suite}"
${lit_suite}
${lit_args}
${EXCLUDE_FROM_CHECK_ALL}
PARAMS ${ARG_PARAMS}
DEPENDS ${ARG_DEPENDS}
Expand Down
Loading