diff options
author | Orkun Tokdemir <ilhanorkuntokdemir@gmail.com> | 2023-05-12 14:49:03 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2023-05-16 14:47:56 (GMT) |
commit | b480315e0c229454c335290b19cc689930d7849f (patch) | |
tree | fd6c95e7d53d4a9c095947ba7cd718e0ce1ae60f /Help/prop_sf | |
parent | 993dde925f208d98c68edcd451b0d6979e0abdd4 (diff) | |
download | CMake-b480315e0c229454c335290b19cc689930d7849f.zip CMake-b480315e0c229454c335290b19cc689930d7849f.tar.gz CMake-b480315e0c229454c335290b19cc689930d7849f.tar.bz2 |
TargetGenerator: Add SKIP_LINTING source property
The `SKIP_LINTING` source property was added to disable code check for
desired source files. The `SKIP_LINTING`includes `cpplint`, `clang-tidy`, \
`cppcheck` and `include-what-you-use`. If `SKIP_LINTING` is set on a
source file, the tools mentioned above will not be run on that source file.
Diffstat (limited to 'Help/prop_sf')
-rw-r--r-- | Help/prop_sf/SKIP_LINTING.rst | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/Help/prop_sf/SKIP_LINTING.rst b/Help/prop_sf/SKIP_LINTING.rst new file mode 100644 index 0000000..2be47cb --- /dev/null +++ b/Help/prop_sf/SKIP_LINTING.rst @@ -0,0 +1,41 @@ +SKIP_LINTING +------------ + +.. versionadded:: 3.27 + +This property allows you to exclude a specific source file +from the linting process. The linting process involves running +tools such as :prop_tgt:`<LANG>_CPPLINT`, :prop_tgt:`<LANG>_CLANG_TIDY`, +:prop_tgt:`<LANG>_CPPCHECK`, and :prop_tgt:`<LANG>_INCLUDE_WHAT_YOU_USE` +on the source files. By setting `SKIP_LINTING` on a source file, +the mentioned linting tools will not be executed for that +particular file. + +EXAMPLE +^^^^^^^ + +Consider a `C++` project that includes multiple source files, +such as `main.cpp`, `things.cpp`, and `generatedBindings.cpp`. +In this example, you want to exclude the `generatedBindings.cpp` +file from the linting process. To achieve this, you can utilize +the `SKIP_LINTING` property with the `set_source_files_properties` +command as shown below: + +.. code-block:: cmake + + add_executable(MyApp main.cpp things.cpp generatedBindings.cpp) + + set_source_files_properties(generatedBindings.cpp PROPERTIES + SKIP_LINTING ON + ) + +In the provided code snippet, the `SKIP_LINTING` property is set to `ON` +for the `generatedBindings.cpp` source file. As a result, when the linting +tools, such as :prop_tgt:`<LANG>_CPPLINT`, :prop_tgt:`<LANG>_CLANG_TIDY`, +:prop_tgt:`<LANG>_CPPCHECK`, and :prop_tgt:`<LANG>_INCLUDE_WHAT_YOU_USE`, +are executed, they will skip analyzing the `generatedBindings.cpp` file. + +By using the `SKIP_LINTING` property, you can selectively exclude specific +source files from the linting process. This allows you to focus the +linting tools on the relevant parts of your project, enhancing the efficiency +and effectiveness of the linting workflow. |