Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
CMake
CMake
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,229
    • Issues 3,229
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge Requests 12
    • Merge Requests 12
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
  • Operations
    • Operations
    • Incidents
    • Environments
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • CI / CD
    • Repository
    • Value Stream
  • External Wiki
    • External Wiki
  • Members
    • Members
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • CMake
  • CMakeCMake
  • Issues
  • #21847

Closed
Open
Opened Feb 20, 2021 by Borislav Stanimirov@iboB

FetchContent: Allow alternative URLs

This is a feature request to allow alternative URLs in FetchContent_Declare. My use case is that I have a local network file server which if available, has orders of magnitude faster access. For users which are not on this network, naturally it's not available, but I can provide an alternative link to a public file server. Sot it would be nice if I could provide alternative URLs for the content in case the main one is not available

Here is a proposed syntax

FetchContent_Declare(
  myCompanyIcons
  URL      http://192.168.0.145/iconset_1.12.tar.gz
  URL_ALT
           https://public.mycompany.com/iconset_1.12.tar.gz
           https://public.mycompany-backup.com/iconset_1.12.tar.gz
  URL_HASH 5588a7b18261c20068beabfb4f530b87
)

Or, maybe, alternatively just make URL a list:

FetchContent_Declare(
  myCompanyIcons
  URL      http://192.168.0.145/iconset_1.12.tar.gz
           https://public.mycompany.com/iconset_1.12.tar.gz
           https://public.mycompany-backup.com/iconset_1.12.tar.gz
  URL_HASH 5588a7b18261c20068beabfb4f530b87
)

I don't think there should be a way to define separate hashes for the alternative URLs, but perhaps there may be also use cases for this (maybe support an alternative with a different version?). I'm not sure what would be a good syntax for them.

Edited Feb 20, 2021 by Borislav Stanimirov
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
None
Due date
None
Reference: cmake/cmake#21847