From c488b8b32f7a08cef19fd075256e1e35e7f52f10 Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Wed, 4 Dec 2019 11:24:06 +0100 Subject: Replace calls to "hg" by calls to "git" --- CMakeLists.txt | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index 36a155133..81c98a026 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -42,27 +42,25 @@ string(REGEX MATCH "define[ \t]+EIGEN_MINOR_VERSION[ \t]+([0-9]+)" _eigen_minor_ set(EIGEN_MINOR_VERSION "${CMAKE_MATCH_1}") set(EIGEN_VERSION_NUMBER ${EIGEN_WORLD_VERSION}.${EIGEN_MAJOR_VERSION}.${EIGEN_MINOR_VERSION}) -# if we are not in a mercurial clone -if(IS_DIRECTORY ${CMAKE_SOURCE_DIR}/.hg) - # if the mercurial program is absent or this will leave the EIGEN_HG_CHANGESET string empty, +# if we are not in a git clone +if(IS_DIRECTORY ${CMAKE_SOURCE_DIR}/.git) + # if the git program is absent or this will leave the EIGEN_GIT_REVNUM string empty, # but won't stop CMake. - execute_process(COMMAND hg tip -R ${CMAKE_SOURCE_DIR} OUTPUT_VARIABLE EIGEN_HGTIP_OUTPUT) - execute_process(COMMAND hg branch -R ${CMAKE_SOURCE_DIR} OUTPUT_VARIABLE EIGEN_BRANCH_OUTPUT) + execute_process(COMMAND git ls-remote --refs -q ${CMAKE_SOURCE_DIR} HEAD OUTPUT_VARIABLE EIGEN_GIT_OUTPUT) endif() -# if this is the default (aka development) branch, extract the mercurial changeset number from the hg tip output... -if(EIGEN_BRANCH_OUTPUT MATCHES "default") -string(REGEX MATCH "^changeset: *[0-9]*:([0-9;a-f]+).*" EIGEN_HG_CHANGESET_MATCH "${EIGEN_HGTIP_OUTPUT}") -set(EIGEN_HG_CHANGESET "${CMAKE_MATCH_1}") +# extract the git rev number from the git output... +if(EIGEN_GIT_OUTPUT) +string(REGEX MATCH "^([0-9;a-f]+).*" EIGEN_GIT_CHANGESET_MATCH "${EIGEN_GIT_OUTPUT}") +set(EIGEN_GIT_REVNUM "${CMAKE_MATCH_1}") endif() #...and show it next to the version number -if(EIGEN_HG_CHANGESET) - set(EIGEN_VERSION "${EIGEN_VERSION_NUMBER} (mercurial changeset ${EIGEN_HG_CHANGESET})") +if(EIGEN_GIT_REVNUM) + set(EIGEN_VERSION "${EIGEN_VERSION_NUMBER} (git rev ${EIGEN_GIT_REVNUM})") else() set(EIGEN_VERSION "${EIGEN_VERSION_NUMBER}") endif() - include(CheckCXXCompilerFlag) include(GNUInstallDirs) -- cgit v1.2.3