Background
I have a large project organized as 20+ repos, one being the logical “parent” from which the CMake project is homed and add_subdirectory() calls chain in the rest, save one. That repo homes a customer-provided simulation that performs an in-tree build controlled by one top-level Korn shell script. Until now we’ve manually run its build beforehand so that the necessary generated artifacts will be present for pickup when our top-level CMake launches CPack to build a Deb for us (we install and configure their sim as sort of a peripheral for our app).
Problem
We now have a new wrinkle where we need to sequence the build roughly as follows:
-
Execute build of some of our targets, which modify a few source files of the vendor sim
-
Kick off the non-CMake in-tree build of the vendor sim at the right point in the sequence Edit: block 3 until 2 done
-
Consume a few generated artifacts in building our final targets before packaging begins
We employ add_dependencies() in several places to control the ordering of our own target builds. I’m also using ExternalProject_Add() to build a CMake-based third-party tool from tree-local sources. I think I have the right control mechanisms but can’t quite make them play together. I’m struggling with (I think) the two following points:
A. ExternalProject_Add() will run at build time. I’m not sure how the CMake sequence-planning logic during the generate phase can work it into the correct spot
B. For some reason, perhaps this external project not being CMake-based as is our other (wild guess), CMake seems to want me to include a project()statement in the controlling CMakeLists.txt file where the External Project is defined. If I do, I put the target name into a separate scope and certainly can’t satisfy ‘A’ (above).
When things get this convoluted I’m usually trying to do something stupid, but this seems like something that should be commonplace, and so doable. Can anyone advise how?