From caa191ff06d0945f539d3789acca5f81f30dcf48 Mon Sep 17 00:00:00 2001 From: Patrick Nicolas Date: Tue, 17 Mar 2026 13:44:08 +0100 Subject: [PATCH] Fail on unset GIT_DESC/GIT_COMMIT --- .github/workflows/Build.yml | 2 ++ cmake/GitVersion.cmake | 6 ++---- flake.nix | 4 ++++ 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/Build.yml b/.github/workflows/Build.yml index 8092e413..dc351172 100644 --- a/.github/workflows/Build.yml +++ b/.github/workflows/Build.yml @@ -141,6 +141,8 @@ jobs: -DFETCHCONTENT_BASE_DIR=${{github.workspace}}/cmake-fetch --preset dashboard -DWIVRN_USE_SYSTEM_OPENXR=OFF + -DGIT_DESC=${{github.sha}} + -DGIT_COMMIT=${{github.sha}} - name: Build # Build your program with the given configuration diff --git a/cmake/GitVersion.cmake b/cmake/GitVersion.cmake index 24533e0f..d46b85b5 100644 --- a/cmake/GitVersion.cmake +++ b/cmake/GitVersion.cmake @@ -20,15 +20,13 @@ if (NOT GIT_COMMIT) endif() if (NOT GIT_DESC) - set(GIT_DESC v${CMAKE_PROJECT_VERSION}) - message(STATUS "Setting version to ${GIT_DESC} from CMakeLists") + message(FATAL_ERROR "GIT_DESC cannot be inferred from .git and was not provided at build time") endif() if (GIT_COMMIT) message(STATUS "Setting commit to ${GIT_COMMIT}") else() - set(GIT_COMMIT "") - message(STATUS "Not setting commit") + message(FATAL_ERROR "GIT_COMMIT cannot be inferred from .git and was not provided at build time") endif() configure_file(${INPUT_FILE} ${OUTPUT_FILE}) diff --git a/flake.nix b/flake.nix index 1fca85e3..18f0cdca 100644 --- a/flake.nix +++ b/flake.nix @@ -64,6 +64,10 @@ buildInputs = oldAttrs.buildInputs ++ extraBuildInputs; nativeBuildInputs = oldAttrs.nativeBuildInputs ++ extraNativeBuildInputs; + cmakeFlags = (oldAttrs.cmakeFlags or []) ++ [ + (lib.cmakeFeature "GIT_DESC" "nightly") + (lib.cmakeFeature "GIT_COMMIT" "nightly") + ]; })); in { packages = {