diff --git a/cmake/modules/AddLLVM.cmake b/cmake/modules/AddLLVM.cmake index f04081befc8..6bdb76259a0 100644 --- a/cmake/modules/AddLLVM.cmake +++ b/cmake/modules/AddLLVM.cmake @@ -1050,13 +1050,28 @@ endfunction() function(add_lit_testsuites project directory) if (NOT CMAKE_CONFIGURATION_TYPES) cmake_parse_arguments(ARG "" "" "PARAMS;DEPENDS;ARGS" ${ARGN}) - file(GLOB_RECURSE litCfg ${directory}/lit*.cfg) + + # Search recursively for test directories by assuming anything not + # in a directory called Inputs contains tests. set(lit_suites) - foreach(f ${litCfg}) - get_filename_component(dir ${f} DIRECTORY) - set(lit_suites ${lit_suites} ${dir}) - endforeach() - list(REMOVE_DUPLICATES lit_suites) + file(GLOB to_process ${directory}/*) + while(to_process) + set(cur_to_process ${to_process}) + set(to_process) + foreach(lit_suite ${cur_to_process}) + if(NOT IS_DIRECTORY ${lit_suite}) + continue() + endif() + string(FIND ${lit_suite} Inputs is_inputs) + if (is_inputs EQUAL -1) + list(APPEND lit_suites "${lit_suite}") + file(GLOB subdirs ${lit_suite}/*) + list(APPEND to_process ${subdirs}) + endif() + endforeach() + endwhile() + + # Now create a check- target for each test directory. foreach(dir ${lit_suites}) string(REPLACE ${directory} "" name_slash ${dir}) if (name_slash)