Skip to content

Commit

Permalink
Make -DCLAD_SOURCE_DIR option work
Browse files Browse the repository at this point in the history
Using the -DCLAD_SOURCE_DIR currently does not disable the git checkout.
From the cmake documentation for ExternalProject_Add:

Note: If a download method is specified, any existing contents of the
source directory may be deleted. Only the URL download method checks
whether this directory is either missing or empty before initiating
the download, stopping with an error if it is not empty. All other
download methods silently discard any previous contents of the source
directory.

Currently cmake deletes the source directory defined by
-DCLAD_SOURCE_DIR and then tries to recreate it using a git checkout,
but fails if there is no network available:

Cloning into 'clad-1.7'...
fatal: unable to access 'https://github.com/vgvassilev/clad.git/': Could not resolve host: github.com
Cloning into 'clad-1.7'...
fatal: unable to access 'https://github.com/vgvassilev/clad.git/': Could not resolve host: github.com
Cloning into 'clad-1.7'...
fatal: unable to access 'https://github.com/vgvassilev/clad.git/': Could not resolve host: github.com
Had to git clone more than once: 3 times.
CMake Error at redhat-linux-build/interpreter/cling/tools/plugins/clad/clad-prefix/tmp/clad-gitclone.cmake:50 (message):
  Failed to clone repository: 'https://github.com/vgvassilev/clad.git'

The attempt to disable the git checkout by setting the
DOWNLOAD_COMMAND option to an empty string is not working.

This commit fixes the issue by only defining the GIT_REPOSITORY and
GIT_TAG options when CLAD_SOURCE_DIR is not defined.
  • Loading branch information
ellert authored and jenkins committed Dec 19, 2024
1 parent 69c24d6 commit 2b0bcc1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tools/plugins/clad/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,10 @@ set(_clad_extra_settings
# If the CLAD_SOURCE_DIR variable is defined in the CMake configuration, we're
# skipping the download of the repository and use the passed directory.
if (DEFINED CLAD_SOURCE_DIR)
list(APPEND _clad_extra_settings DOWNLOAD_COMMAND "")
list(APPEND _clad_extra_settings SOURCE_DIR ${CLAD_SOURCE_DIR})
else()
list(APPEND _clad_extra_settings GIT_REPOSITORY https://github.com/vgvassilev/clad.git)
list(APPEND _clad_extra_settings GIT_TAG v1.7)
endif()

#list(APPEND _clad_patches_list "patch1.patch" "patch2.patch")
Expand All @@ -82,8 +84,6 @@ endif()

ExternalProject_Add(
clad
GIT_REPOSITORY https://github.com/vgvassilev/clad.git
GIT_TAG v1.7
UPDATE_COMMAND ""
PATCH_COMMAND ${_clad_patch_command}
CMAKE_ARGS -G ${CMAKE_GENERATOR}
Expand Down

0 comments on commit 2b0bcc1

Please sign in to comment.