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
  • #19899
Closed
Open
Created Oct 30, 2019 by Alok Priyadarshi@alokpr

FetchContent: Populate fails when SOURCE_DIR is specified

cmake version 3.15.4 on Ubuntu 18.04 somepath/foo/CMakeLists.txt:

include(FetchContent)
FetchContent_Declare(foo
  URL https://foo.com/foo.tar.bz2
)
FetchContent_Populate(foo
  SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src
)

My goal is to still let FetchContent_Populate fetch the source but in a non-default location specified in SOURCE_DIR. FetchContent_Populate however assumes that I want to specify an already populated source directory and fails with the following error message:

Make Error at /usr/share/cmake-3.15/Modules/ExternalProject.cmake:2611 (message):
  No download info given for 'foo-populate' and its source directory:

   somepath/foo/src

  is not an existing non-empty directory.  Please specify one of:

   * SOURCE_DIR with an existing non-empty directory
   * DOWNLOAD_COMMAND
   * URL
   * GIT_REPOSITORY
   * SVN_REPOSITORY
   * HG_REPOSITORY
   * CVS_REPOSITORY and CVS_MODULE
Call Stack (most recent call first):
  /usr/share/cmake-3.15/Modules/ExternalProject.cmake:3204 (_ep_add_download_command)
  CMakeLists.txt:13 (ExternalProject_Add)

From the documentation, my understand is that a pre-populated source directory is specified by defining FETCHCONTENT_SOURCE_DIR_ucName; specifying SOURCE_DIR in FetchContent_Populate should only override the default source location.

If my understanding is incorrect, what is the recommended way to accomplish my goal?

Edited Oct 30, 2019 by Alok Priyadarshi
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking