mirror of
https://github.com/Kitware/CMake.git
synced 2026-02-25 10:18:34 -06:00
ExternalProject: Remove N^2 add_dependencies() calls
ExternalProject_Add_StepDependencies() contained a foreach() loop that had another foreach() loop inside it iterating over the same set of values (the dependencies). This resulted in add_dependencies() calls that added the same dependencies to the step target N^2 times. A single call to add_dependencies() with the list of dependencies provides the necessary relationships without the N^2 behavior, and it removes the inner foreach() loop.
This commit is contained in:
@@ -2746,12 +2746,10 @@ function(ExternalProject_Add_StepDependencies name step)
|
||||
OUTPUT ${stamp_file}
|
||||
DEPENDS ${dep}
|
||||
)
|
||||
if(TARGET ${name}-${step})
|
||||
foreach(dep ${dependencies})
|
||||
add_dependencies(${name}-${step} ${dep})
|
||||
endforeach()
|
||||
endif()
|
||||
endforeach()
|
||||
if(TARGET ${name}-${step})
|
||||
add_dependencies(${name}-${step} ${dependencies})
|
||||
endif()
|
||||
|
||||
endfunction()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user