mesonbuild / meson

The Meson Build System
http://mesonbuild.com
Apache License 2.0
5.55k stars 1.61k forks source link

Allow custom "targets" that aren't top-level targets #1319

Open doraskayo opened 7 years ago

doraskayo commented 7 years ago

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).

keszybz commented 6 years ago

368 is more-or-less the opposite of this.