cmake: git hooks for non-unix os

Add support for non-unix systems that have bash shell.

Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
This commit is contained in:
Janusz Jankowski 2019-05-21 11:16:09 +02:00
parent 3e423f418e
commit df48bfce77
1 changed files with 10 additions and 1 deletions

View File

@ -5,8 +5,17 @@ if(NOT EXISTS "${SOF_ROOT_SOURCE_DIRECTORY}/.git")
endif()
if(NOT CMAKE_HOST_UNIX)
execute_process(
COMMAND sh -c echo
RESULT_VARIABLE sh_result
OUTPUT_QUIET
ERROR_QUIET
)
if(NOT (sh_result STREQUAL "0"))
return()
endif()
endif()
set(pre_commit_hook "${SOF_ROOT_SOURCE_DIRECTORY}/.git/hooks/pre-commit")
set(post_commit_hook "${SOF_ROOT_SOURCE_DIRECTORY}/.git/hooks/post-commit")