diff options
Diffstat (limited to 'Tests/FindGit/Test/RunGit.cmake')
-rw-r--r-- | Tests/FindGit/Test/RunGit.cmake | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/Tests/FindGit/Test/RunGit.cmake b/Tests/FindGit/Test/RunGit.cmake new file mode 100644 index 0000000..f798cd3 --- /dev/null +++ b/Tests/FindGit/Test/RunGit.cmake @@ -0,0 +1,20 @@ +cmake_minimum_required(VERSION 3.12) + +function(run_git exe exe_display) + execute_process(COMMAND ${exe} --version + OUTPUT_VARIABLE output + OUTPUT_STRIP_TRAILING_WHITESPACE + RESULT_VARIABLE result + ) + + if(NOT result EQUAL 0) + message(SEND_ERROR "Result of ${exe_display} --version is ${result}, should be 0") + endif() + + if(NOT output STREQUAL "git version ${GIT_VERSION_STRING}") + message(SEND_ERROR "Output of ${exe_display} --version is \"${output}\", should be \"git version ${GIT_VERSION_STRING}\"") + endif() +endfunction() + +run_git("${GIT_EXECUTABLE}" "\${GIT_EXECUTABLE}") +run_git("${GIT_EXECUTABLE_TARGET}" "Git::Git") |