Unverified Commit fe56cf04 authored by Axel Kohlmeyer's avatar Axel Kohlmeyer
Browse files

simplify the detection of whether the source folder is checked out from a local git repo

parent 436e02aa
Loading
Loading
Loading
Loading
+12 −18
Original line number Diff line number Diff line
@@ -1336,12 +1336,7 @@ set(temp_git_commit "(unknown)")
set(temp_git_branch "(unknown)")
set(temp_git_describe "(unknown)")
set(temp_git_info "false")
if(GIT_FOUND)
  execute_process(COMMAND ${GIT_EXECUTABLE} describe HEAD
    RESULT_VARIABLE temp_in_git_checkout
    ERROR_QUIET
    OUTPUT_STRIP_TRAILING_WHITESPACE)
  if(temp_in_git_checkout EQUAL 0)
if(GIT_FOUND AND EXISTS ${CMAKE_SOURCE_DIR}/.git)
  set(temp_git_info "true")
  execute_process(COMMAND ${GIT_EXECUTABLE} rev-parse HEAD
    OUTPUT_VARIABLE temp_git_commit
@@ -1356,7 +1351,6 @@ if(GIT_FOUND)
    ERROR_QUIET
    OUTPUT_STRIP_TRAILING_WHITESPACE)
endif()
endif()

set(temp "${temp}const bool LAMMPS_NS::LAMMPS::has_git_info = ${temp_git_info};\n")
set(temp "${temp}const char LAMMPS_NS::LAMMPS::git_commit[] = \"${temp_git_commit}\";\n")