[CMake] Removing duplicates from the list of test suites to generate targets for.
[oota-llvm.git] / cmake / modules / AddLLVM.cmake
index 50cee302d0e86727454aa0d9e675e7030d5f03ea..5d906bbc1be265792e15b4c0f2671a4e9654f5e7 100644 (file)
@@ -547,6 +547,18 @@ endmacro(add_llvm_example name)
 macro(add_llvm_utility name)
   add_llvm_executable(${name} ${ARGN})
   set_target_properties(${name} PROPERTIES FOLDER "Utils")
+  if( LLVM_INSTALL_UTILS )
+    install (TARGETS ${name}
+      RUNTIME DESTINATION bin
+      COMPONENT ${name})
+    if (NOT CMAKE_CONFIGURATION_TYPES)
+      add_custom_target(install-${name}
+                        DEPENDS ${name}
+                        COMMAND "${CMAKE_COMMAND}"
+                                -DCMAKE_INSTALL_COMPONENT=${name}
+                                -P "${CMAKE_BINARY_DIR}/cmake_install.cmake")
+    endif()
+  endif()
 endmacro(add_llvm_utility name)
 
 
@@ -791,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)
+    set(lit_suites)
     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})