From 0369011c2386845f6c5398b43c63015f10898fba Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Mon, 4 Nov 2019 23:44:34 +0000 Subject: [PATCH] Add KDEClangFormat cmake support Summary: This allows devs to run: "make clang-format" and format all files easily using the preset KDE clang format style This patch adds support so devs can easily test the intended formatting now, it doesn't change the code yet. Doing an initial run to commit everything will happen later. Test Plan: Ran script git diff was full of amazingly cleaned code See D25134 --- CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index b1dccce4ea..cf72544892 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,6 +14,7 @@ find_package(ECM 5.38 REQUIRED NO_MODULE) include(FeatureSummary) include(WriteBasicConfigVersionFile) include(GenerateExportHeader) +include(KDEClangFormat) # where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/ is checked set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR}) @@ -739,6 +740,10 @@ endif() add_subdirectory(kconf_update) +# add clang-format target for all our real source files +file(GLOB_RECURSE ALL_CLANG_FORMAT_SOURCE_FILES *.cpp *.h) +kde_clang_format(${ALL_CLANG_FORMAT_SOURCE_FILES}) + feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES) include(CMakePackageConfigHelpers)