fix git-revision.h generation: output to build tree and add missing dependencies
All checks were successful
Build and Deploy Documentation / build-and-deploy (push) Successful in 18s
All checks were successful
Build and Deploy Documentation / build-and-deploy (push) Successful in 18s
Generate git-revision.h into CMAKE_BINARY_DIR/src/ (which is in the include path) instead of the source tree. Remove the header from add_executable() source lists, and add missing add_dependencies on git_revision for all Qt5/Qt6 targets. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,13 +1,18 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Usage: git_revision.sh <output_dir>
|
||||
# Generates git-revision.h in the specified output directory.
|
||||
|
||||
OUTPUT_DIR="${1:-.}"
|
||||
|
||||
echo "-- Generating header for git hash"
|
||||
GIT_HEADER="src/git-revision.h"
|
||||
[ -d src ] || mkdir src
|
||||
GIT_HEADER="${OUTPUT_DIR}/git-revision.h"
|
||||
[ -d "${OUTPUT_DIR}" ] || mkdir -p "${OUTPUT_DIR}"
|
||||
|
||||
GIT_BRANCH=`git rev-parse --abbrev-ref HEAD`
|
||||
|
||||
GIT_VERSION=`git log -n 1 --pretty=format:"%ad - %h"`
|
||||
if [ "$(grep -ics "$GIT_VERSION" $GIT_HEADER)" = 1 ]
|
||||
if [ -f "$GIT_HEADER" ] && [ "$(grep -cs "$GIT_VERSION" "$GIT_HEADER")" = 1 ]
|
||||
then
|
||||
echo "-- No need to generate new $GIT_HEADER - git hash is unchanged"
|
||||
exit 0;
|
||||
|
||||
Reference in New Issue
Block a user