generate git-revision.h at build time instead of configure time
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
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:
@@ -240,12 +240,16 @@ endif ()
|
|||||||
|
|
||||||
#--- start create git-revision.h ----------------------------------------------
|
#--- start create git-revision.h ----------------------------------------------
|
||||||
if (IS_GIT_REPO)
|
if (IS_GIT_REPO)
|
||||||
execute_process(COMMAND sh ${CMAKE_SOURCE_DIR}/src/git_revision.sh)
|
add_custom_target(git_revision ALL
|
||||||
|
COMMAND sh ${CMAKE_SOURCE_DIR}/src/git_revision.sh
|
||||||
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||||
|
COMMENT "Checking git revision"
|
||||||
|
)
|
||||||
|
|
||||||
set(HAVE_GIT_REV_H "-DHAVE_GIT_REV_H")
|
set(HAVE_GIT_REV_H "-DHAVE_GIT_REV_H")
|
||||||
set(GIT_REV_H "git-revision.h")
|
set(GIT_REV_H "git-revision.h")
|
||||||
else (IS_GIT_REPO)
|
else (IS_GIT_REPO)
|
||||||
set(HAVE_GIT_REV_H "")
|
set(HAVE_GIT_REV_H "")
|
||||||
set(GIT_REV_H "")
|
set(GIT_REV_H "")
|
||||||
endif (IS_GIT_REPO)
|
endif (IS_GIT_REPO)
|
||||||
|
|
||||||
|
|||||||
@@ -145,6 +145,20 @@ target_include_directories(write_musrRoot_runHeader
|
|||||||
)
|
)
|
||||||
target_link_libraries(write_musrRoot_runHeader ${ROOT_LIBRARIES} ${MUSRFIT_LIBS} ${LIBXML2_LIBRARIES})
|
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 --------------------------------------------------------
|
#--- installation info --------------------------------------------------------
|
||||||
install(
|
install(
|
||||||
TARGETS
|
TARGETS
|
||||||
|
|||||||
Reference in New Issue
Block a user