try to avoid GIT_TAG and replace it with GIT_REMOTE_NAME so that the repository don't get downloaded and compiled each time

i have a question: i read in the docs that when i use GIT_TAG with externalproject he is not able to check wether he has to checkout and build fresh becaues GIT_TAG can change in a repository.

So i try to use GIT_REMOTE_NAME but i have no clue what parameter i should pass it… if i pass the revision number i get the following error:

GIT_REMOTE_NAME is to change origin or the like. I don’t think it has anything to do with that. Maybe you want UPDATE_DISCONNECTED 1?


-------------- error -------------
[ 4%] Creating directories for ‘external_glad’
[ 8%] Performing download step (git clone) for ‘external_glad’
Klone nach ‘glad-src’…
remote: Enumerating objects: 6646, done.
remote: Counting objects: 100% (261/261), done.
remote: Compressing objects: 100% (143/143), done.
remote: Total 6646 (delta 91), reused 207 (delta 79), pack-reused 6385
Empfange Objekte: 100% (6646/6646), 5.63 MiB | 24.02 MiB/s, fertig.
Löse Unterschiede auf: 100% (3710/3710), fertig.
Branch ‘master’ folgt nun ‘origin/master’.
Zu neuem Branch ‘master’ gewechselt
[ 13%] No patch step for ‘external_glad’
[ 17%] Performing configure step for ‘external_glad’
– The C compiler identification is GNU 12.2.0
– Detecting C compiler ABI info
– Detecting C compiler ABI info - done
– Check for working C compiler: /usr/bin/cc - skipped
– Detecting C compile features
– Detecting C compile features - done
– Found Python: /usr/bin/python3 (found version “3.11.2”) found components: Interpreter
– Configuring done
– Generating done
– Build files have been written to: /home/stuv/data/programming/projects/c/svg-KUI/build/glad/src/external_glad-build
[ 21%] Performing build step for ‘external_glad’
[ 25%] Generating GLAD
[10/01/2023 05:32:30][INFO ][glad ]: downloading latest ‘gl’ specification
[10/01/2023 05:32:30][INFO ][glad.opener ]: opening: ‘
[10/01/2023 05:32:31][INFO ][glad ]: generating ‘gl’ bindings: {‘gl’: None}
[10/01/2023 05:32:31][INFO ][glad.opener ]: saving: ‘’ to ‘/home/stuv/data/programming/projects/c/svg-KUI/build/glad/src/external_glad-build/include/KHR/khrplatform.h’
[10/01/2023 05:32:31][INFO ][glad ]: generating ‘gl’ bindings - done
[ 25%] Built target glad-generate-files
[ 50%] Building C object CMakeFiles/glad.dir/src/glad.c.o
[ 75%] Linking C static library libglad.a
[100%] Built target glad
[ 26%] Performing install step for ‘external_glad’
[ 25%] Built target glad-generate-files
[100%] Built target glad
Install the project…
– Install configuration: “Release”
– Installing: /home/stuv/data/programming/projects/c/svg-KUI/out/Release/lib/glad/lib/libglad.a
– Installing: /home/stuv/data/programming/projects/c/svg-KUI/out/Release/lib/glad/include/glad/glad.h
– Installing: /home/stuv/data/programming/projects/c/svg-KUI/out/Release/lib/glad/include/KHR/khrplatform.h
– Installing: /home/stuv/data/programming/projects/c/svg-KUI/out/Release/lib/glad/lib/cmake/glad/gladConfig.cmake
– Installing: /home/stuv/data/programming/projects/c/svg-KUI/out/Release/lib/glad/lib/cmake/glad/gladConfigVersion.cmake
– Old export file “/home/stuv/data/programming/projects/c/svg-KUI/out/Release/lib/glad/lib/cmake/glad/gladTargets.cmake” will be replaced. Removing files [/home/stuv/data/programming/projects/c/svg-KUI/out/Release/lib/glad/lib/cmake/glad/gladTargets-debug.cmake, /home/stuv/data/programming/projects/c/svg-KUI/out/Release/lib/glad/lib/cmake/glad/gladTargets-release.cmake].
– Installing: /home/stuv/data/programming/projects/c/svg-KUI/out/Release/lib/glad/lib/cmake/glad/gladTargets.cmake
– Installing: /home/stuv/data/programming/projects/c/svg-KUI/out/Release/lib/glad/lib/cmake/glad/gladTargets-release.cmake
[ 30%] Completed ‘external_glad’
[ 30%] Built target external_glad
[ 34%] Creating directories for ‘external_glfw’
[ 39%] Performing download step (git clone) for ‘external_glfw’
– Avoiding repeated git clone, stamp file is up to date: ‘/home/stuv/data/programming/projects/c/svg-KUI/build/glfw/src’
[ 43%] Performing update step for ‘external_glfw’
CMake Error at /home/stuv/data/programming/projects/c/svg-KUI/build/glfw/tmp/external_glfw-gitupdate.cmake:25 (message):
Failed to get the hash for HEAD:

Schwerwiegend: Kein Git-Repository: ‘.git’

gmake[2]: *** [CMakeFiles/external_glfw.dir/build.make:118: glfw/src/external_glfw-stamp/external_glfw-update] Fehler 1
gmake[1]: *** [CMakeFiles/Makefile2:119: CMakeFiles/external_glfw.dir/all] Fehler 2
gmake: *** [Makefile:146: all] Fehler 2

i think that did the trick =)

I’m not sure you’ve understood that correctly.

From cmake documentation for ExternalProject_Add:

If GIT_TAG is a specific hash, then CMake knows that it only needs to download once, because a git hash maps to a single unique commit. If GIT_TAG is a branch or tag, then you are tracking a potentially moving target so CMake will verify it each time.

Correct design is to use a fixed hash unless you actually want to track a moving target.

My reading of the docs is that UPDATE_DISCONNECTED is for when you want to clone the git repo once and then have your git tag (branch or tag) track the local git repo and not the remote. Any updates to the local repo have to be triggered manually.