summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Help/prop_sf/SKIP_LINTING.rst5
-rw-r--r--Help/prop_tgt/VERIFY_INTERFACE_HEADER_SETS.rst3
-rw-r--r--Source/cmGeneratorTarget.cxx4
-rw-r--r--Tests/RunCMake/VerifyHeaderSets/RunCMakeTest.cmake1
-rw-r--r--Tests/RunCMake/VerifyHeaderSets/VerifyHeaderSets.cmake5
-rw-r--r--Tests/RunCMake/VerifyHeaderSets/skip_linting.h3
6 files changed, 19 insertions, 2 deletions
diff --git a/Help/prop_sf/SKIP_LINTING.rst b/Help/prop_sf/SKIP_LINTING.rst
index 19592a8..0e0a616 100644
--- a/Help/prop_sf/SKIP_LINTING.rst
+++ b/Help/prop_sf/SKIP_LINTING.rst
@@ -7,8 +7,9 @@ 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
+on the source files, as well as compiling header files as part of
+:prop_tgt:`VERIFY_INTERFACE_HEADER_SETS`. By setting ``SKIP_LINTING`` on a
+source file, the mentioned linting tools will not be executed for that
particular file.
Example
diff --git a/Help/prop_tgt/VERIFY_INTERFACE_HEADER_SETS.rst b/Help/prop_tgt/VERIFY_INTERFACE_HEADER_SETS.rst
index dd415c8..bdd7792 100644
--- a/Help/prop_tgt/VERIFY_INTERFACE_HEADER_SETS.rst
+++ b/Help/prop_tgt/VERIFY_INTERFACE_HEADER_SETS.rst
@@ -26,6 +26,9 @@ Otherwise, if C++ is enabled globally, the header is compiled as C++.
Otherwise, if C is enabled globally, the header is compiled as C. Otherwise,
the header file is not compiled.
+If the header's :prop_sf:`SKIP_LINTING` property is set to true, the file is
+not compiled.
+
If any verification targets are created, a top-level target called
``all_verify_interface_header_sets`` is created which depends on all
verification targets.
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 3cefeda..357d0a6 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -8796,6 +8796,10 @@ std::string cmGeneratorTarget::GenerateHeaderSetVerificationFile(
std::string extension;
std::string language = source.GetOrDetermineLanguage();
+ if (source.GetPropertyAsBool("SKIP_LINTING")) {
+ return std::string{};
+ }
+
if (language.empty()) {
if (!languages) {
languages.emplace();
diff --git a/Tests/RunCMake/VerifyHeaderSets/RunCMakeTest.cmake b/Tests/RunCMake/VerifyHeaderSets/RunCMakeTest.cmake
index b4fe720..982087f 100644
--- a/Tests/RunCMake/VerifyHeaderSets/RunCMakeTest.cmake
+++ b/Tests/RunCMake/VerifyHeaderSets/RunCMakeTest.cmake
@@ -42,6 +42,7 @@ run_cmake_build(VerifyHeaderSets lang_test_c_verify_interface_header_sets)
run_cmake_build(VerifyHeaderSets lang_test_cxx_verify_interface_header_sets)
run_cmake_build(VerifyHeaderSets interface_lang_test_cxx_verify_interface_header_sets)
run_cmake_build(VerifyHeaderSets list_verify_interface_header_sets)
+run_cmake_build(VerifyHeaderSets skip_linting_verify_interface_header_sets)
set(RunCMake_TEST_OPTIONS -DCMAKE_VERIFY_INTERFACE_HEADER_SETS=ON)
run_cmake(AllVerifyInterfaceHeaderSets)
diff --git a/Tests/RunCMake/VerifyHeaderSets/VerifyHeaderSets.cmake b/Tests/RunCMake/VerifyHeaderSets/VerifyHeaderSets.cmake
index f260609..7de9f1e 100644
--- a/Tests/RunCMake/VerifyHeaderSets/VerifyHeaderSets.cmake
+++ b/Tests/RunCMake/VerifyHeaderSets/VerifyHeaderSets.cmake
@@ -74,3 +74,8 @@ target_sources(list INTERFACE
FILE_SET error TYPE HEADERS FILES error.h
)
set_property(TARGET list PROPERTY INTERFACE_HEADER_SETS_TO_VERIFY "a;c")
+
+add_library(skip_linting STATIC lib.c)
+target_sources(skip_linting INTERFACE FILE_SET HEADERS FILES lang_test.h skip_linting.h)
+set_property(SOURCE skip_linting.h PROPERTY LANGUAGE C)
+set_property(SOURCE skip_linting.h PROPERTY SKIP_LINTING TRUE)
diff --git a/Tests/RunCMake/VerifyHeaderSets/skip_linting.h b/Tests/RunCMake/VerifyHeaderSets/skip_linting.h
new file mode 100644
index 0000000..908ca95
--- /dev/null
+++ b/Tests/RunCMake/VerifyHeaderSets/skip_linting.h
@@ -0,0 +1,3 @@
+#error "This file should not be included"
+
+extern void skip_linting_h(void);