[libc][NFC] Reduce CMake configuration time
authorGuillaume Chatelet <gchatelet@google.com>
Mon, 23 Jan 2023 16:52:46 +0000 (16:52 +0000)
committerGuillaume Chatelet <gchatelet@google.com>
Mon, 23 Jan 2023 17:02:27 +0000 (17:02 +0000)
This patch reduces CMake configuration time drastically by removing a non-linear behavior.
Time to execute CMake configure step goes from 45s to 15s.

Differential Revision: https://reviews.llvm.org/D142374

libc/cmake/modules/LLVMLibCLibraryRules.cmake

index ba5ac33..279e15b 100644 (file)
@@ -12,6 +12,7 @@ function(collect_object_file_deps target result)
       collect_object_file_deps(${dep} dep_targets)
       list(APPEND all_deps ${dep_targets})
     endforeach(dep)
+    list(REMOVE_DUPLICATES all_deps)
     set(${result} ${all_deps} PARENT_SCOPE)
     return()
   endif()
@@ -33,6 +34,7 @@ function(collect_object_file_deps target result)
       collect_object_file_deps(${dep} dep_targets)
       list(APPEND all_deps ${dep_targets})
     endforeach(dep)
+    list(REMOVE_DUPLICATES all_deps)
     set(${result} ${all_deps} PARENT_SCOPE)
     return()
   endif()