Support for better IDE integration of utility targets
Sometimes a utility command is applied to another target/project, and it is not intuitive to consider the utility command as another target built. Examples: all, debug, upload etc, that can be appropriately included by the IDE in target/project-specific context menu.
May be done as below?
add_custom_command(TARGET <target-to-which-applied>
UTILITY <utility-name>
COMMAND command1 [ARGS] [args1...]
...
)
Currently, as a workaround, I do the following (Of course, not a CMake provided standard way for IDEs)
add_custom_target(<utility-name>-<target-to-which-applied>
command1 [args1...]
...
)
add_dependencies(<utility-name>-<target-to-which-applied> <target-to-which-applied>)
I believe that the CMake can support this simply by creating a custom target for the utility using '/' (instead of '-' in the workaround) i.e. <utility-name>/<target-to-which-applied>
and adding the dependency. Advantage to IDE's is that it is a documented standard mechanism.
EDIT: Considering the already available <target>/fast
, the convention can be <target-to-which-applied>/<utility-name>
as well (instead of <utility-name>/<target-to-which-applied>
). This convention also allows <utility-name>
to contain slash '/' in order to create hierarchical utilities e.g. 'upload/local', 'upload/remote' etc.
Similarly, project specific or OUTPUT utility may be as below?
add_custom_command(UTILITY <utility-name>
COMMAND command1 [ARGS] [args1...]
...
)
In this case it is sufficient to create a target with name <utility-name>
, and identifying the target as UTILITY_TARGET in file API.