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,308
    • Issues 3,308
    • 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
  • #21498

Closed
Open
Created Nov 24, 2020 by Ian Dikhof@Warmyone

ExternalProject_Add fails with trailing slash for SOURCE_DIR

Using CMake 3.18 with ExternalProject_Add(name SOURCE_DIR "${CMAKE_BINARY_DIR}/name-src/" I get the error:

CMake Error at C:/Program Files/CMake/share/cmake-3.18/Modules/ExternalProject.cmake:2411 (_ep_write_gitclone_script):
  _ep_write_gitclone_script Function invoked with incorrect arguments for
  function named: _ep_write_gitclone_script
Call Stack (most recent call first):
  C:/Program Files/CMake/share/cmake-3.18/Modules/ExternalProject.cmake:3213 (_ep_add_download_command)
  CMakeLists.txt:50 (ExternalProject_Add)

Looking into that file I found:

    get_filename_component(src_name "${source_dir}" NAME) #<-- this is empty if source_dir has trailing slash
    get_filename_component(work_dir "${source_dir}" PATH)
...
    _ep_write_gitclone_script(${tmp_dir}/${name}-gitclone.cmake ${source_dir}
      ${GIT_EXECUTABLE} ${git_repository} ${git_tag} ${git_remote_name} ${git_init_submodules} "${git_submodules_recurse}" "${git_submodules}" "${git_shallow}" "${git_progress}" "${git_config}" ${src_name} ${work_dir}
      ${stamp_dir}/${name}-gitinfo.txt ${stamp_dir}/${name}-gitclone-lastrun.txt "${tls_verify}"
      ) #<-- then ${src_name} resolves to nothing and the error occures 

In the ExternalProject_Add doku I found no hint about this. Also, by checking for empty ${src_name} a helpful error message could be thrown.

maybe related: #19969

Edited Nov 24, 2020 by Ian Dikhof
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