generate git-revision.h at build time instead of configure time

Replace execute_process with add_custom_target so the git revision
check runs on every build, not just on cmake configure.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-29 19:35:20 +01:00
parent fb9d6e917c
commit 00c980af68
2 changed files with 21 additions and 3 deletions

View File

@@ -145,6 +145,20 @@ target_include_directories(write_musrRoot_runHeader
)
target_link_libraries(write_musrRoot_runHeader ${ROOT_LIBRARIES} ${MUSRFIT_LIBS} ${LIBXML2_LIBRARIES})
#--- ensure git-revision.h is regenerated before compiling --------------------
if (IS_GIT_REPO)
add_dependencies(addRun git_revision)
add_dependencies(any2many git_revision)
add_dependencies(dump_header git_revision)
add_dependencies(msr2data git_revision)
add_dependencies(musrfit git_revision)
add_dependencies(musrFT git_revision)
add_dependencies(musrRootValidation git_revision)
add_dependencies(musrt0 git_revision)
add_dependencies(musrview git_revision)
add_dependencies(write_musrRoot_runHeader git_revision)
endif (IS_GIT_REPO)
#--- installation info --------------------------------------------------------
install(
TARGETS