Closed SYury closed 3 weeks ago
GIT_SHALLOW <bool>
New in version 3.6. When this option is enabled, the git clone operation will be given the --depth 1 option. This performs a shallow clone, which avoids downloading the whole history and instead retrieves just the commit denoted by the GIT_TAG option.
ref: https://cmake.org/cmake/help/latest/module/ExternalProject.html#command:externalproject_add
Since we target at least CMake 3.18, it should be safe, on my way to test it...
Done with https://github.com/google/or-tools/commit/f5d9ea77be10a8d33f1e1afbcd9201fcdc9828f3
note: GIT_SHALLOW
do not work when using commit sha1
What language and solver does this apply to? CMake build
Describe the problem you are trying to solve. I tried building OR-Tools with all dependencies on a machine with slow and unreliable internet access (very strict corporate proxy) and
git clone
couldn't fetch some of the largest dependencies (e. g. protobuf) because of their size. The problem went away when I forced CMake to reduce the size by making shallow clone. Describe the solution you'd like Add GIT_SHALLOW 1 toFetchContent_Declare
for large dependencies in dependencies CMakeLists. It shouldn't break anything because CMake only needs the latest commit to build a dependency.