I have a subproject in my project for generating code used in the project, however i want to include it using ExternalProject so it can be built and ran regardless of the toolchain i use for the main project.
It mostly works except i can't figure out how to use it in add_custom_command
, since i want it to use the target rule specified in the docs:
If COMMAND specifies an executable target name (created by the add_executable() command), it will automatically be replaced by the location of the executable created at build time [...]
Simple example of my project setup that replicates the issue: https://godbolt.org/z/of8G4c4Gf
Replacing the ExternalProject_Add
with a simple add_subdirectory
makes it work, but wouldn't do what i want in the case of using a different toolchain.