<div>Hi,</div><div><br></div><div>I&#39;m working on a project which depends on several external projects (mostly</div><div>non-CMake), so naturally I&#39;ve been taking a look at using ExternalProject to </div><div>build these prerequisites. I&#39;ve got a simple &quot;superproject&quot; working that just </div>
<div>builds one of these external projects using ExternalProject_Add and that works</div><div>nicely, building and installing the project (a library plus headers) into a</div><div>directory under the build directory of the superproject.</div>
<div><br></div><div>    </div><div>What I haven&#39;t been able to work out is if there&#39;s a good way, or if it&#39;s even </div><div>good practice, to install the libraries, headers and applications built under </div>
<div>ExternalProject_Add as part of the install of the superproject. The idea here</div><div>is to provide a (semi) complete solution for an end user so they don&#39;t have to </div><div>install and set up all the dependencies by hand (many of the packages are</div>
<div>scientific software, so not commonly available pre-packaged).</div><div><br></div><div>So far, my test superproject uses the install command with the DIRECTORY </div><div>signature to install the contents of the external_project INSTALL_DIR </div>
<div>to a location under the CMAKE_INSTALL_PREFIX for the superproject. That works,</div><div>but if parts of the external project are prefix-aware, some paths in scripts </div><div>are not correct in the &quot;superinstall&quot; as they point to somewhere under the</div>
<div>build directory of the superproject. </div><div><br></div><div>I think I might be able to fix this by setting prefixes of the external</div><div>projects to their final superinstall location, missing out the install step in</div>
<div>ExternalProject_Add and then using install(CODE ...) to somehow hook into the</div><div>actual install command of the external project. </div><div><br></div><div>That seems possible, but I wanted to check that I&#39;m not over-reaching the </div>
<div>purpose of ExternalProject_Add, or implementing bad practice with regard to </div><div>installing dependencies! Or is there a better way to do this installation with</div><div>ExternalProject_Add?</div><div><br></div>
<div><br></div><div>The other option I can think of is converting all the external projects to </div><div>CMake as VTK and Paraview do(?) for things like libxml2? That&#39;s clearly more </div><div>work, but would it be a cleaner solution overall since everything would be</div>
<div>under the CMake umbrella?</div><div><br></div><div><br></div><div>Best Regards,</div><div><br></div><div>Ben Morgan.</div>