The parent project or user can supply EXTERNAL_MPGEN, which will override the one set here. If not set, the internally built one is used instead.
This is useful for cross builds, especially when using libmultiprocess as a subdirectory. Parent projects can similarly define a cache var.
Note that the internal binary is still built, but it can be skipped by building the multiprocess target directly.
This is the simplest impl of this I could come up with. Trying to pass an optional option for the binary into target_capnp_sources is not very ergonomic with CMake, so I’ve opted for just using a global here instead.
It would probably make sense to disable the internal mpgen target if the external option is used, but that adds a good bit of complexity, so I haven’t done it here. Happy to do it as a follow-up if desired.