fix git-revision.h generation: output to build tree and add missing dependencies

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:
2026-01-29 19:52:16 +01:00
parent 00c980af68
commit d4f0855b19
11 changed files with 51 additions and 16 deletions

View File

@@ -268,16 +268,14 @@ endif ()
#--- start create git-revision.h ----------------------------------------------
if (IS_GIT_REPO)
add_custom_target(git_revision ALL
COMMAND sh ${CMAKE_SOURCE_DIR}/src/git_revision.sh
COMMAND sh ${CMAKE_SOURCE_DIR}/src/git_revision.sh ${CMAKE_BINARY_DIR}/src
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
COMMENT "Checking git revision"
)
set(HAVE_GIT_REV_H "-DHAVE_GIT_REV_H")
set(GIT_REV_H "git-revision.h")
else (IS_GIT_REPO)
set(HAVE_GIT_REV_H "")
set(GIT_REV_H "")
endif (IS_GIT_REPO)
#--- end create git-revision.h ------------------------------------------------