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
This commit is contained in:
David Edmundson 2019-11-04 23:44:34 +00:00
parent a0d98a61c5
commit 0369011c23

View file

@ -14,6 +14,7 @@ find_package(ECM 5.38 REQUIRED NO_MODULE)
include(FeatureSummary) include(FeatureSummary)
include(WriteBasicConfigVersionFile) include(WriteBasicConfigVersionFile)
include(GenerateExportHeader) include(GenerateExportHeader)
include(KDEClangFormat)
# where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/ is checked # 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}) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR})
@ -739,6 +740,10 @@ endif()
add_subdirectory(kconf_update) 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) feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES)
include(CMakePackageConfigHelpers) include(CMakePackageConfigHelpers)