summaryrefslogtreecommitdiff
path: root/Help/prop_tgt/LANG_CLANG_TIDY.rst
diff options
context:
space:
mode:
authorCraig Scott <craig.scott@crascit.com>2022-10-06 16:14:04 +1100
committerBrad King <brad.king@kitware.com>2022-10-07 10:33:32 -0400
commit3f4e0839c48480b0cb3396ddbcadef25e69854ee (patch)
tree58c0aeaa4804ab2685d0e0c1db5e2295089d99ef /Help/prop_tgt/LANG_CLANG_TIDY.rst
parent1e364201e6738a34d39a9522c050768b7ad88559 (diff)
downloadcmake-3f4e0839c48480b0cb3396ddbcadef25e69854ee.tar.gz
clang-tidy: Don't append compiler commands if using -p
When the -p option is given to clang-tidy, it doesn't need the compile command line to be appended. It can get everything it needs from the compile_commands.json file in the directory specified with the -p option. When the compiler being used is not the system default compiler, clang-tidy has been observed to pick up the wrong headers when the compiler command line is given, but not if only the -p option is used. Therefore, don't append the compiler command line if -p is present in the <LANG>_CLANG_TIDY target property. Fixes: #24017
Diffstat (limited to 'Help/prop_tgt/LANG_CLANG_TIDY.rst')
-rw-r--r--Help/prop_tgt/LANG_CLANG_TIDY.rst18
1 files changed, 15 insertions, 3 deletions
diff --git a/Help/prop_tgt/LANG_CLANG_TIDY.rst b/Help/prop_tgt/LANG_CLANG_TIDY.rst
index af16d3c5bd..ffa0b9a205 100644
--- a/Help/prop_tgt/LANG_CLANG_TIDY.rst
+++ b/Help/prop_tgt/LANG_CLANG_TIDY.rst
@@ -3,13 +3,25 @@
.. versionadded:: 3.6
-This property is implemented only when ``<LANG>`` is ``C``, ``CXX``, ``OBJC`` or ``OBJCXX``.
+This property is implemented only when ``<LANG>`` is ``C``, ``CXX``, ``OBJC``
+or ``OBJCXX``.
-Specify a :ref:`semicolon-separated list <CMake Language Lists>` containing a command
-line for the ``clang-tidy`` tool. The :ref:`Makefile Generators`
+Specify a :ref:`semicolon-separated list <CMake Language Lists>` containing
+a command line for the ``clang-tidy`` tool. The :ref:`Makefile Generators`
and the :generator:`Ninja` generator will run this tool along with the
compiler and report a warning if the tool reports any problems.
+The specified ``clang-tidy`` command line will be invoked with additional
+arguments specifying the source file and, after ``--``, the full compiler
+command line.
+
+.. versionchanged:: 3.25
+
+ If the specified ``clang-tidy`` command line includes the ``-p`` option,
+ it will invoked without ``--`` and the full compiler command line.
+ ``clang-tidy`` will look up the source file in the specified compiler
+ commands database.
+
This property is initialized by the value of
the :variable:`CMAKE_<LANG>_CLANG_TIDY` variable if it is set
when a target is created.