Skip to content

Commit

Permalink
check in git then get abs_path, avoid add_dep
Browse files Browse the repository at this point in the history
Co-authored-by: Tobias Ribizel <ribizel@kit.edu>
  • Loading branch information
yhmtsai and upsj committed Jul 16, 2021
1 parent 8b49b65 commit 7e6788a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
5 changes: 4 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,10 @@ if(GINKGO_DEVEL_TOOLS)
add_custom_target(add_license
COMMAND ${Ginkgo_SOURCE_DIR}/dev_tools/scripts/add_license.sh
WORKING_DIRECTORY ${Ginkgo_SOURCE_DIR})
add_dependencies(format add_license)
# if git-cmake-format can not build format target, do not add the dependencies
if(TARGET format)
add_dependencies(format add_license)
endif()
endif()

# MacOS needs to install bash, gnu-sed, findutils and coreutils
Expand Down
6 changes: 5 additions & 1 deletion third_party/dummy-hook/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,12 @@ if(GIT_FOUND)
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE Ginkgo_GIT_HOOKS_DIR
OUTPUT_STRIP_TRAILING_WHITESPACE)
# If it is not in git, give an error and return
if(NOT Ginkgo_GIT_HOOKS_DIR)
message(STATUS "Ginkgo is not in git structure, so no git hook was install")
return()
endif()
get_filename_component(Ginkgo_GIT_HOOKS_DIR ${Ginkgo_GIT_HOOKS_DIR} REALPATH BASE_DIR ${CMAKE_SOURCE_DIR})

if(EXISTS "${Ginkgo_GIT_HOOKS_DIR}")
set(ADD_HOOK FALSE)
set(HOOK_LOCATION "${Ginkgo_GIT_HOOKS_DIR}/pre-commit")
Expand Down
2 changes: 1 addition & 1 deletion third_party/git-cmake-format/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ include(FetchContent)
FetchContent_Declare(
git_cmake_format
GIT_REPOSITORY https://github.com/ginkgo-project/git-cmake-format.git
GIT_TAG 069338e8afd47e6a27e661940cd36e940253f81c
GIT_TAG e9a82f20d36f1a92d4c52910a8d0a694e7673c54
)
FetchContent_GetProperties(git_cmake_format)
if(NOT git_cmake_format_POPULATED)
Expand Down

0 comments on commit 7e6788a

Please sign in to comment.