Skip to content

Commit

Permalink
luajit-cmake: Add git repository existence check
Browse files Browse the repository at this point in the history
Thanks @xl-sec!!!

Signed-off-by: Hiroshi Hatake <[email protected]>
Co-authored-by: XL-SEC <[email protected]>
  • Loading branch information
2 people authored and edsiper committed Jul 10, 2024
1 parent fb82d84 commit 85e9bf3
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions lib/luajit-cmake/LuaJIT.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -426,10 +426,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 85e9bf3

Please sign in to comment.