From 1d562b54e75227029022427a3adc911e8b5a1ade Mon Sep 17 00:00:00 2001 From: "k.koide" Date: Wed, 6 Nov 2024 11:13:51 +0900 Subject: [PATCH] embed git commit id --- CMakeLists.txt | 8 ++++++++ include/gtsam_points/config.hpp.in | 2 ++ 2 files changed, 10 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9fb42a8..d7b8163 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -118,6 +118,14 @@ if(ENABLE_COVERAGE) WORKING_DIRECTORY ${CMAKE_BINARY_DIR}) endif() +execute_process( + COMMAND git log -1 --format=%h + WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} + OUTPUT_VARIABLE GTSAM_POINTS_GIT_HASH + OUTPUT_STRIP_TRAILING_WHITESPACE + ) +message(STATUS "GTSAM_POINTS_GIT_HASH=${GTSAM_POINTS_GIT_HASH}") + configure_file(include/gtsam_points/config.hpp.in include/gtsam_points/config.hpp) ########### diff --git a/include/gtsam_points/config.hpp.in b/include/gtsam_points/config.hpp.in index 28bb2c3..6408464 100644 --- a/include/gtsam_points/config.hpp.in +++ b/include/gtsam_points/config.hpp.in @@ -9,6 +9,8 @@ #define GTSAM_POINTS_VERSION_PATCH @CMAKE_PROJECT_VERSION_PATCH@ #define GTSAM_POINTS_VERSION_STRING "@CMAKE_PROJECT_VERSION@" +#define GTSAM_POINTS_GIT_HASH "@GTSAM_POINTS_GIT_HASH@" + #cmakedefine GTSAM_POINTS_USE_TBB #cmakedefine GTSAM_POINTS_USE_OPENMP