rpavlik/cmake-modules

git_get_exact_tag and new tags

Opened this issue · 2 comments

Adding a new git tag does not force a re-configure if cmake variables with git_get_exact_tag

git_get_exact_tag(GIT_TAG)
if(NOT GIT_TAG)
    set(GIT_TAG "")
endif()
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/gitinfo.cpp.in ${CMAKE_CURRENT_BINARY_DIR}/gitinfo.cpp)

Some files:

gitinfo.h

extern const char g_GIT_TAG[];

gitinfo.cpp.in

#define GIT_TAG "@GIT_TAG@"
const char g_GIT_TAG[] = GIT_TAG;

Hmm. Is there a file with a known location that we can watch to trigger a re-configure?

I suppose you could check for changes in .git/refs/tags