diff --git a/CMakeLists.txt b/CMakeLists.txt index 2a833689a..77f32011d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -152,11 +152,6 @@ if (CLANG OR GCC) endif() endif() -if (NOT DEFINED TD_GIT_COMMIT) - include(GetGitInfo) - get_git_info() -endif() - add_subdirectory(tdtl) add_subdirectory(tdutils) diff --git a/tdutils/CMakeLists.txt b/tdutils/CMakeLists.txt index 2aed70b52..5b96fd555 100644 --- a/tdutils/CMakeLists.txt +++ b/tdutils/CMakeLists.txt @@ -343,6 +343,9 @@ set(TDUTILS_TEST_SOURCE add_library(tdutils STATIC ${TDUTILS_SOURCE}) if (DEFINED TD_GIT_COMMIT) + # this forces the whole tdutils to be recompiled after each commit with Makefile generator as explained at + # https://cmake.org/pipermail/cmake-developers/2012-October/005411.html, + # so this can't be improved for production-ready state set_property(SOURCE td/utils/GitInfo.cpp APPEND PROPERTY COMPILE_DEFINITIONS "GIT_COMMIT=\"${TD_GIT_COMMIT}\"") endif() if (DEFINED TD_GIT_DIRTY)