I have several executable targets AppA, AppB …
And several libs LibA, LibB, LibC… which one or several executables depend on.
Normal way of doing code generation is attaching custom command dependency to each lib and it works well. However in my specific case it would help me optimization-wise to do code generation for several libs simultaneously (with single custom command).
So when building AppA I would like to do codegen for all the libs it depends on. Searching for dependencies is not an issue in my case but doing the custom command before any dependency starts building is something I can’t solve.
If I make CodegenAppA a direct dependency of all AppA lib dependencies then I’m facing the issue that if LibA is a dependency of several executables e.g. AppA and AppB. Then both CodegenAppA and CodegenAppB will run when LibA is built while building AppA only which I would like to avoid. Since I can’t know what targets user specified to be built it seems impossible.
Am I correct in assuming that the only semi-solution I could do is optimize for single executable only specified during configuration?
What annoys me about this problem is that it seems really simple to specify as a command line e.g. codegen-with-deps AppA && make AppA
but it seems impossible to specify this in build system, making it inconvenient e.g. for ide users. Also building with script, there’s an issue with multi-config generators such as VS.