[CMake] Removing duplicates from the list of test suites to generate targets for.
authorChris Bieneman <beanz@apple.com>
Fri, 27 Mar 2015 21:45:49 +0000 (21:45 +0000)
committerChris Bieneman <beanz@apple.com>
Fri, 27 Mar 2015 21:45:49 +0000 (21:45 +0000)
Not doing this causes some headaches for users migrating from autoconf to CMake.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233428 91177308-0d34-0410-b5e6-96231b3b80d8

cmake/modules/AddLLVM.cmake

index 1bb98a14d4954e23e898ba8ee8b018421dac5868..5d906bbc1be265792e15b4c0f2671a4e9654f5e7 100644 (file)
@@ -803,8 +803,13 @@ function(add_lit_testsuites project directory)
   if (NOT CMAKE_CONFIGURATION_TYPES)
     parse_arguments(ARG "PARAMS;DEPENDS;ARGS" "" ${ARGN})
     file(GLOB_RECURSE litCfg ${directory}/lit*.cfg)
   if (NOT CMAKE_CONFIGURATION_TYPES)
     parse_arguments(ARG "PARAMS;DEPENDS;ARGS" "" ${ARGN})
     file(GLOB_RECURSE litCfg ${directory}/lit*.cfg)
+    set(lit_suites)
     foreach(f ${litCfg})
       get_filename_component(dir ${f} DIRECTORY)
     foreach(f ${litCfg})
       get_filename_component(dir ${f} DIRECTORY)
+      set(lit_suites ${lit_suites} ${dir})
+    endforeach()
+    list(REMOVE_DUPLICATES lit_suites)
+    foreach(dir ${lit_suites})
       string(REPLACE ${directory} "" name_slash ${dir})
       if (name_slash)
         string(REPLACE "/" "-" name_slash ${name_slash})
       string(REPLACE ${directory} "" name_slash ${dir})
       if (name_slash)
         string(REPLACE "/" "-" name_slash ${name_slash})