Skip to content

Commit 2df27d7

Browse files
authored
setup pre-commit hook at cmake generation time (#9669)
Co-authored-by: Chris McFarlen <cmcfarlen@apple.com>
1 parent a46778a commit 2df27d7

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

CMakeLists.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,3 +231,14 @@ add_custom_target(clang-format
231231
DEPENDS ${CLANG_FORMAT_TARGETS}
232232
VERBATIM
233233
)
234+
235+
add_custom_target(autopep8 ${CMAKE_SOURCE_DIR}/tools/autopep8.sh ${CMAKE_SOURCE_DIR}
236+
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
237+
COMMENT "formatting python files"
238+
VERBATIM
239+
)
240+
241+
if(NOT EXISTS ${CMAKE_SOURCE_DIR}/.git/hooks/pre-commit)
242+
message("Installing github hook")
243+
configure_file(${CMAKE_SOURCE_DIR}/tools/git/pre-commit ${CMAKE_SOURCE_DIR}/.git/hooks/pre-commit COPYONLY)
244+
endif()

0 commit comments

Comments
 (0)