Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • CMake CMake
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,818
    • Issues 3,818
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 8
    • Merge requests 8
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Releases
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • External wiki
    • External wiki
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • CMake
  • CMakeCMake
  • Issues
  • #20690
Closed
Open
Created May 11, 2020 by Arun@arunmozhi_v

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.

Edited May 12, 2020 by Arun
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking