From 129f37050ea057fb02434df05badc3d8f96d6752 Mon Sep 17 00:00:00 2001 From: Ed Savage Date: Tue, 1 Sep 2026 09:12:02 +1200 Subject: [PATCH] Fail CMake configure if 3rd-party git clone fails (#3164) Previously, execute_process() silently ignored a non-zero exit from the git clone command. If the GitLab server is unavailable or overloaded, CMake would continue configuring with no Eigen headers present, leading to a cryptic compiler error hundreds of lines later instead of a clear configure-time failure. Same hardening for valijson as for pull-eigen.cmake: report a clear configure-time error if the git clone fails rather than silently continuing and producing a cryptic compiler error later. (cherry picked from commit f95b8ef64348a8b5889b169e2ed77c696c497372) --- 3rd_party/pull-eigen.cmake | 4 ++++ 3rd_party/pull-valijson.cmake | 9 ++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/3rd_party/pull-eigen.cmake b/3rd_party/pull-eigen.cmake index adcfc7a1bc..1a76f5a8c5 100644 --- a/3rd_party/pull-eigen.cmake +++ b/3rd_party/pull-eigen.cmake @@ -42,5 +42,9 @@ if(PULL_EIGEN) execute_process( COMMAND git -c advice.detachedHead=false clone --depth=1 --branch=3.4.0 https://gitlab.com/libeigen/eigen.git WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} + RESULT_VARIABLE GIT_RESULT ) + if(NOT GIT_RESULT EQUAL 0) + message(FATAL_ERROR "Failed to clone Eigen from https://gitlab.com/libeigen/eigen.git: git exited with ${GIT_RESULT}. Check network connectivity, proxy settings, and git availability.") + endif() endif() diff --git a/3rd_party/pull-valijson.cmake b/3rd_party/pull-valijson.cmake index 13f6e3e408..c80d4838d6 100644 --- a/3rd_party/pull-valijson.cmake +++ b/3rd_party/pull-valijson.cmake @@ -16,5 +16,12 @@ # This cmake script is expected to be called from a target or custom command with WORKING_DIRECTORY set to this file's location if ( NOT EXISTS valijson ) - execute_process( COMMAND git -c advice.detachedHead=false clone --depth=1 --branch=v1.0.2 https://github.com/tristanpenman/valijson.git WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}) + execute_process( + COMMAND git -c advice.detachedHead=false clone --depth=1 --branch=v1.0.2 https://github.com/tristanpenman/valijson.git + WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} + RESULT_VARIABLE GIT_RESULT + ) + if(NOT GIT_RESULT EQUAL 0) + message(FATAL_ERROR "Failed to clone Valijson from https://github.com/tristanpenman/valijson.git: git exited with ${GIT_RESULT}. Check network connectivity, proxy settings, and git availability.") + endif() endif()