summaryrefslogtreecommitdiffstats
path: root/Source/cmGlobalCommonGenerator.cxx
diff options
context:
space:
mode:
authorKyle Edwards <kyle.edwards@kitware.com>2022-11-29 18:39:10 (GMT)
committerKyle Edwards <kyle.edwards@kitware.com>2022-12-06 15:39:29 (GMT)
commit232467eb1c0dab9156cd8c4af56aad3959cbee4b (patch)
tree2772b01850c143598e642282966401cb976dd421 /Source/cmGlobalCommonGenerator.cxx
parent7ea665b74da322e96dd3e7f90075143c2957728c (diff)
downloadCMake-232467eb1c0dab9156cd8c4af56aad3959cbee4b.zip
CMake-232467eb1c0dab9156cd8c4af56aad3959cbee4b.tar.gz
CMake-232467eb1c0dab9156cd8c4af56aad3959cbee4b.tar.bz2
clang-tidy: add <LANG>_CLANG_TIDY_EXPORT_FIXES_DIR property
Fixes: #21362
Diffstat (limited to 'Source/cmGlobalCommonGenerator.cxx')
-rw-r--r--Source/cmGlobalCommonGenerator.cxx24
1 files changed, 24 insertions, 0 deletions
diff --git a/Source/cmGlobalCommonGenerator.cxx b/Source/cmGlobalCommonGenerator.cxx
index 3ae66f0..7a44452 100644
--- a/Source/cmGlobalCommonGenerator.cxx
+++ b/Source/cmGlobalCommonGenerator.cxx
@@ -2,11 +2,14 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmGlobalCommonGenerator.h"
+#include <algorithm>
#include <memory>
#include <utility>
#include <cmext/algorithm>
+#include <cmsys/Glob.hxx>
+
#include "cmGeneratorExpression.h"
#include "cmGeneratorTarget.h"
#include "cmLocalGenerator.h"
@@ -14,6 +17,7 @@
#include "cmStateDirectory.h"
#include "cmStateSnapshot.h"
#include "cmStateTypes.h"
+#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmValue.h"
#include "cmake.h"
@@ -124,3 +128,23 @@ std::string cmGlobalCommonGenerator::GetEditCacheCommand() const
cmValue edit_cmd = cm->GetCacheDefinition("CMAKE_EDIT_COMMAND");
return edit_cmd ? *edit_cmd : std::string();
}
+
+void cmGlobalCommonGenerator::RemoveUnknownClangTidyExportFixesFiles() const
+{
+ for (auto const& dir : this->ClangTidyExportFixesDirs) {
+ cmsys::Glob g;
+ g.SetRecurse(true);
+ g.SetListDirs(false);
+ g.FindFiles(cmStrCat(dir, "/*.yaml"));
+ for (auto const& file : g.GetFiles()) {
+ if (!this->ClangTidyExportFixesFiles.count(file) &&
+ !std::any_of(this->ClangTidyExportFixesFiles.begin(),
+ this->ClangTidyExportFixesFiles.end(),
+ [&file](const std::string& knownFile) -> bool {
+ return cmSystemTools::SameFile(file, knownFile);
+ })) {
+ cmSystemTools::RemoveFile(file);
+ }
+ }
+ }
+}