Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Register
  • Sign in
  • CMake CMake
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Issues 4,163
    • Issues 4,163
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 19
    • Merge requests 19
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Releases
  • Packages and registries
    • Packages and 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
  • CMakeCMake
  • CMakeCMake
  • Issues
  • #17823
Closed
Open
Issue created Mar 13, 2018 by Marc Chevrier@marc.chevrierMaintainer

List() command: extends capabilities

I propose to extend command list() by adding various new sub-commands.

Before starting implementation, I need feed-back about these propositions. I sorted them by importance (most important/useful first) from my point of view.

  • SUBLIST: to extract a sub-list from a list.
# list (SUBLIST <list> <start> <length> <output variable>)
set (mylist a b c d)
list (SUBLIST mylist 1 -1 sublist)
# result: b c d
  • CONCAT: To concatenate a PREFIX or a SUFFIX to each list's elements.
# list (CONCAT <list> <PREFIX|SUFFIX> <value>)
set (dirs dir1 dir2)
list (CONCAT dirs PREFIX "/root/")
# result: /root/dir1 /root/dir2
  • INSERT: To insert, BEFORE or AFTER each list's elements a new value.
# list (INSERT <list> <BEFORE|AFTER> <value>)
set (defines DEF1 DEF2)
list (INSERT defines BEFORE "-D")
# result: -D DEF1 -D DEF2
  • REPLACE_AT, REPLACE_ITEM, REPLACE: To replace elements with new value.
# list (REPLACE_AT <list> <index> [<index> ...] <new value>)
# list (REPLACE_ITEM <list> <value> [<value> ...] <new value>)
# list (REPLACE <list> <regex> <new value>)
set (defines DEF1 DEF2 OTHER)
list (REPLACE defines "(.+[0-1]+)$" "NEW_\\1")
# result: NEW_DEF1 NEW_DEF2 OTHER
  • TOUPPER, TOUPPER_AT, TOUPPER_ITEM, TOLOWER, TOLOWER_AT, TOLOWER_ITEM: change case of all list's elements.
# list (TOUPPER <list>)
# list (TOUPPER_AT <list> <index> [<index> ...])
# list (TOUPPER_ITEM <list> <value> [<value> ...])
# list (TOLOWER <list>)
# list (TOLOWER_AT <list> <index> [<index> ...])
# list (TOLOWER_ITEM <list> <value> [<value> ...])
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking