Depending upon a POST_BUILD of an ExternalProject

Having an issue… I add an external project which is a cmake project which creates an output, then as post build creates additional files, from the main project it then adds targets that depend on these post build files, this seems to work when manually running this as a one-off but is prone to a timing/load issue whereby it can fail because the post build in the external project can run after the project itself has finished. I have browsed the documentation and cannot see any way of linking to the POST_BUILD of an external project, or the generated files, using the DEPENDS argument on a add_custom_target() call - is there any way to do that, perhaps something I’ve missed or overlooked?

Not really AFAIK. ExternalProject works best when everything in the project is also an ExternalProject. For mixing other project builds into your own, FetchContent may be a better way to go.

Cc: @craig.scott

How/where are you adding the POST_BUILD commands? I suspect you’re adding those in a way that isn’t supported, but without seeing the details, I can’t comment further.

POST_BUILD is being added by the underlying code here:
This is added from the other project by using ExternalProject_Add here:
Can FetchContent be used without external e.g. web content? The files generated in this case are conversions of elf to hex, bin, etc.