You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: ClangTidy.cmake
+62-15Lines changed: 62 additions & 15 deletions
Original file line number
Diff line number
Diff line change
@@ -13,31 +13,60 @@
13
13
#
14
14
# A module to create custom targets to lint source files using clang-tidy
15
15
#
16
-
# Call swift_create_clang_tidy_targets at the end of the top level CMakeLists.txt to create targets for running clang-tidy
16
+
# Call swift_create_clang_tidy_targets at the end of the top level
17
+
# CMakeLists.txt to create targets for running clang-tidy
17
18
#
18
-
# clang-tidy version 6 must be available on the system for this module to work properly. If an appropriate clang-tidy can't be found no targets will be created and a warning will
19
-
# be logged
19
+
# clang-tidy version 6 must be available on the system for this module to work
20
+
# properly. If an appropriate clang-tidy can't be found no targets will be
21
+
# created and a warning will be logged
20
22
#
21
-
# swift_create_clang_tidy_targets will only have an effect for top level projects. If called within a subproject it will return without taking any action
23
+
# swift_create_clang_tidy_targets will only have an effect for top level
24
+
# projects. If called within a subproject it will return without taking any
25
+
# action
22
26
#
23
-
# For every compilable target defined within the calling repository two targets will be created.
27
+
# For every compilable target defined within the calling repository two targets
28
+
# will be created.
24
29
#
25
-
# The first target 'clang-tidy-${target}' will invoke clang-tidy for all source files which make up the given target. It will export fixes to a file called 'fixes-${target}.yaml'
26
-
# in the top level project source directory.
30
+
# The first target 'clang-tidy-${target}' will invoke clang-tidy for all source
31
+
# files which make up the given target. It will export fixes to a file called
32
+
# 'fixes-${target}.yaml' in the top level project source directory.
27
33
#
28
-
# The second target 'clang-tidy-${target}-check' will run clang-tidy as the target described above and then return an error code if any warning/errors were generated
34
+
# The second target 'clang-tidy-${target}-check' will run clang-tidy as the
35
+
# target described above and then return an error code if any warning/errors
36
+
# were generated
29
37
#
30
-
# In addition there are two other targets created which lint multiple targets at the same time
38
+
# In addition there are two other targets created which lint multiple targets
39
+
# at the same time
31
40
#
32
-
# clang-tidy-all runs clang-tidy on all "core" targets in the repository (targets which were added with swift_add_executable or swift_add_library)
41
+
# clang-tidy-all runs clang-tidy on all "core" targets in the repository
42
+
# (targets which were added with swift_add_executable or swift_add_library)
33
43
#
34
-
# clang-tidy-world runs clang-tidy on all compilable targets in the repository including all test suites
44
+
# clang-tidy-world runs clang-tidy on all compilable targets in the repository
45
+
# including all test suites
35
46
#
36
-
# clang-tidy-all and clang-tidy-world each have a "check" variant which returns an error code should any warning/errors be generated
47
+
# clang-tidy-all and clang-tidy-world each have a "check" variant which returns
48
+
# an error code should any warning/errors be generated
37
49
#
38
-
# swift_create_clang_tidy_targets will generate a .clang-tidy file in the project source directory which contains the Swift master config for clang-tidy. There is no need for
39
-
# repositories to maintain their own version of .clang-tidy, it should be added to .gitignore in each repository to prevent being checked in. Pass the option
40
-
# DONT_GENERATE_CLANG_TIDY_CONFIG to disable the autogenerated config
50
+
# swift_create_clang_tidy_targets will generate a .clang-tidy file in the
51
+
# project source directory which contains the Swift master config for
52
+
# clang-tidy. There is no need for repositories to maintain their own version
53
+
# of .clang-tidy, it should be added to .gitignore in each repository to
54
+
# prevent being checked in. Pass the option DONT_GENERATE_CLANG_TIDY_CONFIG to
55
+
# disable the autogenerated config
56
+
#
57
+
# In addition this function sets up a cmake option which can be used to control
58
+
# whether the targets are created either on the command line or by a super project.
59
+
# The option has the name
60
+
#
61
+
# ${PROJECT_NAME}_ENABLE_CLANG_TIDY
62
+
#
63
+
# The default value is ON for top level projects, and OFF for any others.
64
+
#
65
+
# Running
66
+
#
67
+
# cmake -D<project>_ENABLE_CLANG_TIDY=OFF ..
68
+
#
69
+
# will explicitly disable these targets from the command line at configure time
41
70
#
42
71
43
72
# Helper function to actually create the targets, not to be used outside this file
0 commit comments