Skip to content

Commit

Permalink
Use 'find_package' to identify the git location
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin D. Weinberg committed Dec 10, 2024
1 parent 57d477b commit 9f13a65
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ find_package(HDF5 COMPONENTS C CXX HL REQUIRED)
find_package(TIRPC) # Check for alternative Sun rpc support
find_package(Eigen3 REQUIRED)
find_package(PNG)
find_package(Git)

# Check for FE
include(FEENABLE)
Expand Down Expand Up @@ -192,15 +193,15 @@ add_compile_definitions(DATTRIB_CUDA=${CUDA_EXP_DATTRIB})

# Get the current working branch
execute_process(
COMMAND git rev-parse --abbrev-ref HEAD
COMMAND ${GIT_EXECUTABLE} rev-parse --abbrev-ref HEAD
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE GIT_BRANCH
OUTPUT_STRIP_TRAILING_WHITESPACE
)

# Git submodule updates
execute_process(
COMMAND git submodule update --init --recursive
COMMAND ${GIT_EXECUTABLE} submodule update --init --recursive
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
RESULT_VARIABLE GIT_SUBMOD_RESULT
)
Expand All @@ -213,7 +214,7 @@ endif()

# Get the latest abbreviated commit hash of the working branch
execute_process(
COMMAND git rev-parse HEAD
COMMAND ${GIT_EXECUTABLE} rev-parse HEAD
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE GIT_COMMIT
OUTPUT_STRIP_TRAILING_WHITESPACE
Expand Down

0 comments on commit 9f13a65

Please sign in to comment.