diff options
author | Justin Bogner <mail@justinbogner.com> | 2016-06-08 22:36:37 +0000 |
---|---|---|
committer | Justin Bogner <mail@justinbogner.com> | 2016-06-08 22:36:37 +0000 |
commit | 578e573655571ca37b6472b9ce9c879275bdd224 (patch) | |
tree | d56972364acec21c2a2637aaecbb08ee2e662f92 /cmake | |
parent | 0fd0a998e1139f2af8508b92db6376bfb13dc91b (diff) |
cmake: Simplify add_lit_testsuites
cmake 3.4 introduced LIST_DIRECTORIES to glob recurse, which can be
used to simplify this code greatly.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272217 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/modules/AddLLVM.cmake | 34 |
1 files changed, 13 insertions, 21 deletions
diff --git a/cmake/modules/AddLLVM.cmake b/cmake/modules/AddLLVM.cmake index 4668ddc78a8..146dde516ab 100644 --- a/cmake/modules/AddLLVM.cmake +++ b/cmake/modules/AddLLVM.cmake @@ -1122,32 +1122,24 @@ function(add_lit_testsuites project directory) # Search recursively for test directories by assuming anything not # in a directory called Inputs contains tests. - set(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(IS_DIRECTORY ${lit_suite}) - 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() - endif() - endforeach() - endwhile() + file(GLOB_RECURSE to_process LIST_DIRECTORIES true ${directory}/*) + foreach(lit_suite ${to_process}) + if(NOT IS_DIRECTORY ${lit_suite}) + continue() + endif() + string(FIND ${lit_suite} Inputs is_inputs) + if (NOT is_inputs EQUAL -1) + continue() + endif() - # Now create a check- target for each test directory. - foreach(dir ${lit_suites}) - string(REPLACE ${directory} "" name_slash ${dir}) + # Create a check- target for the directory. + string(REPLACE ${directory} "" name_slash ${lit_suite}) if (name_slash) string(REPLACE "/" "-" name_slash ${name_slash}) string(REPLACE "\\" "-" name_dashes ${name_slash}) string(TOLOWER "${project}${name_dashes}" name_var) - add_lit_target("check-${name_var}" "Running lit suite ${dir}" - ${dir} + add_lit_target("check-${name_var}" "Running lit suite ${lit_suite}" + ${lit_suite} PARAMS ${ARG_PARAMS} DEPENDS ${ARG_DEPENDS} ARGS ${ARG_ARGS} |