aboutsummaryrefslogtreecommitdiff
path: root/kde-modules
diff options
context:
space:
mode:
authorAlexander Lohnau <alexander.lohnau@gmx.de>2021-01-27 17:31:44 +0100
committerChristoph Cullmann <cullmann@kde.org>2021-01-30 14:46:18 +0000
commita50e45b8986f01f6b6c85f68d59a4491610ce29c (patch)
tree33ee72213bef5f45b2cabf824038e1cfa73a72f6 /kde-modules
parent0d5ed9bb9117f6526691b3572bf85090efbeed4a (diff)
downloadextra-cmake-modules-a50e45b8986f01f6b6c85f68d59a4491610ce29c.tar.gz
extra-cmake-modules-a50e45b8986f01f6b6c85f68d59a4491610ce29c.tar.bz2
Remove optional parameter
This makes it more difficult to implement the relative paths. It would be nice to have, but if we encounter a scenario where we explicitly need this we can revisit it.
Diffstat (limited to 'kde-modules')
-rw-r--r--kde-modules/KDEGitCommitHooks.cmake13
1 files changed, 4 insertions, 9 deletions
diff --git a/kde-modules/KDEGitCommitHooks.cmake b/kde-modules/KDEGitCommitHooks.cmake
index 1ad93470..02c8f60f 100644
--- a/kde-modules/KDEGitCommitHooks.cmake
+++ b/kde-modules/KDEGitCommitHooks.cmake
@@ -11,12 +11,9 @@
#
# kde_configure_pre_commit_hook(
# CHECKS <check1> [<check2> [...]]
-# [GIT_DIR <dir>]
# )
#
# This function will create a pre-commit hook which contains all the given checks.
-# In case the source dir does not contain the .git folder, the GIT_DIR
-# parameter can be passed in.
#
# Checks:
#
@@ -49,19 +46,17 @@ set(PRE_COMMIT_HOOK_UNIX "${CMAKE_CURRENT_LIST_DIR}/kde-git-commit-hooks/pre-com
set(CLANG_FORMAT_UNIX "${CMAKE_CURRENT_LIST_DIR}/kde-git-commit-hooks/clang-format.sh")
function(KDE_CONFIGURE_GIT_PRE_COMMIT_HOOK)
- set(_oneValueArgs GIT_DIR)
+ set(_oneValueArgs "")
set(_multiValueArgs CHECKS)
cmake_parse_arguments(ARG "" "${_oneValueArgs}" "${_multiValueArgs}" ${ARGN} )
if(NOT ARG_CHECKS)
message(FATAL_ERROR "No checks were specified")
endif()
- if(NOT ARG_GIT_DIR)
- set(ARG_GIT_DIR "${CMAKE_SOURCE_DIR}/.git")
- endif()
+ set(GIT_DIR "${CMAKE_SOURCE_DIR}/.git")
# In case of tarballs there is no .git directory
- if (EXISTS ${ARG_GIT_DIR})
+ if (EXISTS ${GIT_DIR})
# The pre-commit hook is a bash script, consequently it won't work on non-unix platforms
if (UNIX)
if(KDE_CLANG_FORMAT_EXECUTABLE)
@@ -73,7 +68,7 @@ function(KDE_CONFIGURE_GIT_PRE_COMMIT_HOOK)
message(WARNING "No clang-format executable was found, skipping the formatting pre-commit hook")
endif()
- configure_file(${PRE_COMMIT_HOOK_UNIX} "${ARG_GIT_DIR}/hooks/pre-commit")
+ configure_file(${PRE_COMMIT_HOOK_UNIX} "${GIT_DIR}/hooks/pre-commit")
endif()
endif()
endfunction()