Some custom targets never actually need to be run directly by the user and only serve as dependencies for other top-level targets. Creating a top-level target for those use cases really clutters IDEs target list for no reason, especially when created in a foreach loop.
CMake solves this issue with the use of add_custom_command(), so you can create commands that define work, but only ever run as part of a top-level target.
It's probably possible to solve this in Meson using a generator() since it doesn't create a top-level target but can still perform work. It would be especially useful in the foreach loop use case, for example, since it can process batches of input very cleanly. However, generators in their current form aren't applicable because they lack support for some key features that only custom_target() provides. For example, they can't handle my personal use case, which is chaining multiple commands (a compiler that compiles the output of a different compiler) and don't accept array inputs (for N..N or N..1 use cases).
Some custom targets never actually need to be run directly by the user and only serve as dependencies for other top-level targets. Creating a top-level target for those use cases really clutters IDEs target list for no reason, especially when created in a foreach loop.
CMake solves this issue with the use of
add_custom_command()
, so you can create commands that define work, but only ever run as part of a top-level target.It's probably possible to solve this in Meson using a
generator()
since it doesn't create a top-level target but can still perform work. It would be especially useful in the foreach loop use case, for example, since it can process batches of input very cleanly. However, generators in their current form aren't applicable because they lack support for some key features that onlycustom_target()
provides. For example, they can't handle my personal use case, which is chaining multiple commands (a compiler that compiles the output of a different compiler) and don't accept array inputs (for N..N or N..1 use cases).