Projects such as GDCM define the project name and dependencies before checking whether the directory name is set:
set(proj GDCM)
set(proj_DEPENDENCIES )
set(GDCM_DEPENDS ${proj})
if(NOT DEFINED GDCM_DIR)
However, external projects PCRE, Numpy, Python, SWIG, ZLIB are the wrong way round:
if(NOT PCRE_DIR)
set(proj PCRE) set(${proj}_DEPENDENCIES "") set(${proj}_DEPENDS ${proj})
This means that, in this example, if you intend to pass in a pre-compiled PCRE, and you set PCRE_DIR, then in the call to
mitkMacroEmptyExternalProject(${proj} "${proj_DEPENDENCIES}")
the ${proj} variable is still set to the project name of the previous project (CppUnit) in this case, and the same problem for the proj_DEPENDENCIES variable.
This means, that 3rd party super builds cannot pass in pre-compiled libraries.