<div dir="ltr">I am working on a CMake project that depends on a couple other projects I have previously written. I would like to include those other projects using "ExternalProject_Add", but I am having some issues.<div><br></div><div>The basic layout of the project is this:</div><div><br></div><div><font face="monospace, monospace">cmake_minimum_required(VERSION 3.14.0)</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">project(ProjectWithDependencies)</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">include(ExternalProject)</font></div><div><font face="monospace, monospace">ExternalProject_Add(Dependency1</font></div><div><font face="monospace, monospace">    GIT_REPOSITORY <URL to git repo></font></div><div><font face="monospace, monospace">)</font></div><div><font face="monospace, monospace">ExternalProject_Add(Dependency2</font></div><div><font face="monospace, monospace">    GIT_REPOSITORY <URL to git repo></font></div><div><font face="monospace, monospace">)</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">find_package(Dependency1 Required)</font></div><div><font face="monospace, monospace">find_package(Dependency2 Required)</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace"># Use targets</font></div><div><br></div><div>I was under the assumption that "ExternalProject_Add" would automatically build and install the dependencies before getting to the "find_package" calls (they are CMake projects so the default build and install commands should be fine) but this doesn't seem to be how it works.</div><div><br></div><div>When I get to "find_package" it fails because the dependency hasn't been installed yet.</div><div><br></div><div>How can I ensure that the dependencies are fully compiled and installed before attempting to find them? (Note: FetchContent doesn't work here because the two projects "Dependency1" and "Dependency2" have targets with the same name which causes FetchContent to fail.)</div><div><br></div><div>Any help is appreciated.</div><div><br></div><div>Thanks,</div><div>Tim</div></div>