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,817
    • Issues 3,817
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 5
    • Merge requests 5
  • 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
  • Merge requests
  • !2830

FetchContent: Reduce boilerplate

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Craig Scott requested to merge craig.scott/cmake:fetchcontent-reduce-boilerplate into master Jan 20, 2019
  • Overview 19
  • Commits 3
  • Pipelines 3
  • Changes 13

When using the FetchContent module, the amount of code needed to implement the population part for most typical cases a barrier to adoption. It also looks scarier than it needs to and involves a lot of boilerplate (see #18754 (closed) for a discussion of this). For many cases, the steps are the same and it will significantly improve usability to provide a function that simply takes the name of the dependencies to populate and then iterate over them with the canonical population pattern.

This MR provides such a function, named FetchContent_MakeAvailable(). I chose that name to focus on what it does without mentioning the specifics of how the content is made available. While for now this involves populating with FetchContent_Populate() and adding to the build with add_subdirectory(), I want to allow for the possibility that in the future it may support additional methods (integration with find_package() being the one most on my mind at the moment). The key point is that after that function returns, the main project should be able to rely on the targets provided by the named dependencies being available to it.

Edited Jan 23, 2019 by Craig Scott
Assignee
Assign to
Reviewer
Request review from
Time tracking
Source branch: fetchcontent-reduce-boilerplate