Skip to content

Commit

Permalink
Add an exsitence check for git repository
Browse files Browse the repository at this point in the history
Signed-off-by: Hiroshi Hatake <[email protected]>
  • Loading branch information
cosmo0920 committed Jul 10, 2024
1 parent fcfabc0 commit dd59a44
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions LuaJIT.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -415,10 +415,17 @@ execute_process(
OUTPUT_STRIP_TRAILING_WHITESPACE
)

if (GIT_EXISTENCE EQUAL 0)
execute_process(
COMMAND git rev-parse --is-inside-work-tree
RESULT_VARIABLE GIT_IN_REPOSITORY
OUTPUT_VARIABLE GIT_IS_IN_REPOSITORY
OUTPUT_STRIP_TRAILING_WHITESPACE
)

if ((GIT_EXISTENCE EQUAL 0) AND (GIT_IN_REPOSITORY EQUAL 0))
message(STATUS "Using Git: ${GIT_VERSION}")
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/luajit_relver.txt
COMMAND git show -s --format=${GIT_FORMAT} > ${CMAKE_CURRENT_BINARY_DIR}/luajit_relver.txt
COMMAND git -c log.showSignature=false show -s --format=${GIT_FORMAT} > ${CMAKE_CURRENT_BINARY_DIR}/luajit_relver.txt
WORKING_DIRECTORY ${LUAJIT_DIR}
)
else()
Expand Down

0 comments on commit dd59a44

Please sign in to comment.