summaryrefslogtreecommitdiff
path: root/Source/cmGlobalVisualStudio8Generator.cxx
diff options
context:
space:
mode:
authorAlexander Neundorf <neundorf@kde.org>2023-03-19 23:30:02 +0100
committerBrad King <brad.king@kitware.com>2023-04-25 17:35:39 -0400
commitdf58dbb0e9ffc204abc82dd64fbf88059e769ec6 (patch)
tree9b96a9546069c057c8686dca5de507e3629aa4d3 /Source/cmGlobalVisualStudio8Generator.cxx
parent659e9ae93722c26b3bd855e021fbad0a3b73af3b (diff)
downloadcmake-df58dbb0e9ffc204abc82dd64fbf88059e769ec6.tar.gz
VS: Add CMake input files to ZERO_CHECK
Add all cmake input files to the `ZERO_CHECK` project. Place files under `CMAKE_SOURCE_DIR` in a folder structure matching the directory structure. This way they are easier to find, and Visual Studio does not close them when reloading the project. Fixes: #24557
Diffstat (limited to 'Source/cmGlobalVisualStudio8Generator.cxx')
-rw-r--r--Source/cmGlobalVisualStudio8Generator.cxx16
1 files changed, 16 insertions, 0 deletions
diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx
index 7c5ad62376..d902c68234 100644
--- a/Source/cmGlobalVisualStudio8Generator.cxx
+++ b/Source/cmGlobalVisualStudio8Generator.cxx
@@ -273,6 +273,22 @@ bool cmGlobalVisualStudio8Generator::AddCheckTarget()
auto new_end = std::unique(listFiles.begin(), listFiles.end());
listFiles.erase(new_end, listFiles.end());
+ // Add all cmake input files which are used by the project
+ // so Visual Studio does not close them when reloading it.
+ for (const std::string& listFile : listFiles) {
+ if (listFile.find("/CMakeFiles/") != std::string::npos) {
+ continue;
+ }
+ if (!cmSystemTools::IsSubDirectory(listFile,
+ lg.GetMakefile()->GetHomeDirectory()) &&
+ !cmSystemTools::IsSubDirectory(
+ listFile, lg.GetMakefile()->GetHomeOutputDirectory())) {
+ continue;
+ }
+
+ tgt->AddSource(listFile);
+ }
+
auto ptr = cm::make_unique<cmGeneratorTarget>(tgt, &lg);
auto* gt = ptr.get();
lg.AddGeneratorTarget(std::move(ptr));