From 79caa00d0949138b237ecced794a903237bcf2b5 Mon Sep 17 00:00:00 2001 From: Alexander Lohnau Date: Sat, 30 Apr 2022 08:57:26 +0200 Subject: 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. --- kde-modules/KDEGitCommitHooks.cmake | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'kde-modules/KDEGitCommitHooks.cmake') 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) -- cgit v1.2.1