aboutsummaryrefslogtreecommitdiff
path: root/kde-modules/KDEGitCommitHooks.cmake
diff options
context:
space:
mode:
authorAlexander Lohnau <alexander.lohnau@gmx.de>2022-04-30 08:57:26 +0200
committerAlexander Lohnau <alexander.lohnau@gmx.de>2022-05-30 17:24:13 +0200
commit79caa00d0949138b237ecced794a903237bcf2b5 (patch)
tree08c7f36936997ad6915cbce7ac12b29390ea1adc /kde-modules/KDEGitCommitHooks.cmake
parent92cac9621217157c5f1947ee0da4ade018cef75c (diff)
downloadextra-cmake-modules-79caa00d0949138b237ecced794a903237bcf2b5.tar.gz
extra-cmake-modules-79caa00d0949138b237ecced794a903237bcf2b5.tar.bz2
KDEGitCommitHooks: Check if KDEClangFormat was included
If the module is not included, the current message would be misleading. Including the module by default is undesirable, because we print out a warning that we do not override an existing module. While this warning is reasonable in most cases, it is annoying for projects that have a custom clang-format file. Checking if a .clang-format file exists and if not including KDEClangFormat is fragile, because it depends on the include order of the modules. Considering all that, a proper warning with instructions on how to fix the issue is IMHO the best way to go.
Diffstat (limited to 'kde-modules/KDEGitCommitHooks.cmake')
-rw-r--r--kde-modules/KDEGitCommitHooks.cmake5
1 files changed, 5 insertions, 0 deletions
diff --git a/kde-modules/KDEGitCommitHooks.cmake b/kde-modules/KDEGitCommitHooks.cmake
index c545352d..f9c48ae4 100644
--- a/kde-modules/KDEGitCommitHooks.cmake
+++ b/kde-modules/KDEGitCommitHooks.cmake
@@ -61,6 +61,11 @@ function(KDE_CONFIGURE_GIT_PRE_COMMIT_HOOK)
)
return()
endif()
+ if (COMMAND KDE_CLANG_FORMAT)
+ set(HAS_CLANG_FORMAT_COMMAND_INCLUDED TRUE)
+ else()
+ set(HAS_CLANG_FORMAT_COMMAND_INCLUDED FALSE)
+ endif()
set(_write_hook FALSE)
if(KDE_CLANG_FORMAT_EXECUTABLE)