Could we put this pattern inside ExternalProject_Include_Dependencies
? To me it looks like a bug in ExternalProject_Include_Dependencies
that it always enforces existence of External_ITK.cmake
even if it is not needed. I think we could solve the issues by adding a check in ExternalProject_Include_Dependencies
that would prevent the function from looking for External_ITK.cmake
if ITK_FOUND
is already set, similarly how it is done here:
I guess by introducing a new SuperBuildPrerequisites.cmake
file we could do more, but things are already so complex that we should really try to avoid adding a new mechanism to make things any more powerful, nicer, and generic and instead we should striving to make this simpler, less flexible, less configurable if at all possible.
If we want to make the Windows build faster I would not bother with the mere 20-30% speedup that /MP
can do, because it rarely, if ever makes a difference - build takes hours either way. However, if we can reach the 30-minute full build from scratch (as on Linux) then it would worth investing time into developing and supporting that build option. Making Windows builds significantly faster using Ninja came up a few years ago, and interestingly nested external project builds caused the problems with that, too. If making things more complicated is inevitable then at least we should check if we can get other benefits out of it, such as faster builds.