summaryrefslogtreecommitdiffstats
path: root/Source/cmTransformDepfile.cxx
diff options
context:
space:
mode:
authorMarc Chevrier <marc.chevrier@gmail.com>2021-04-16 12:39:23 (GMT)
committerMarc Chevrier <marc.chevrier@gmail.com>2021-04-17 09:05:26 (GMT)
commit253aff6c94401f468ea8f9c953d325c5a8c72eb0 (patch)
treeeb747d684e3e544ea2350f58bad201e8a028b90f /Source/cmTransformDepfile.cxx
parent94fb2516f00fe345326f6a82dc41f2236c481ed3 (diff)
downloadCMake-253aff6c94401f468ea8f9c953d325c5a8c72eb0.zip
CMake-253aff6c94401f468ea8f9c953d325c5a8c72eb0.tar.gz
CMake-253aff6c94401f468ea8f9c953d325c5a8c72eb0.tar.bz2
Xcode: Add support of DEPFILE for add_custom_command, part 2
This MR extend the support of 'DEPFILE' to buildsystem version 1. Issue: #20286
Diffstat (limited to 'Source/cmTransformDepfile.cxx')
-rw-r--r--Source/cmTransformDepfile.cxx20
1 files changed, 17 insertions, 3 deletions
diff --git a/Source/cmTransformDepfile.cxx b/Source/cmTransformDepfile.cxx
index b693582..6e0366c 100644
--- a/Source/cmTransformDepfile.cxx
+++ b/Source/cmTransformDepfile.cxx
@@ -36,8 +36,9 @@ void WriteFilenameGcc(cmsys::ofstream& fout, const std::string& filename)
}
}
-void WriteGccDepfile(cmsys::ofstream& fout, const cmLocalGenerator& lg,
- const cmGccDepfileContent& content)
+void WriteDepfile(cmDepfileFormat format, cmsys::ofstream& fout,
+ const cmLocalGenerator& lg,
+ const cmGccDepfileContent& content)
{
const auto& binDir = lg.GetBinaryDirectory();
std::function<std::string(const std::string&)> formatPath =
@@ -65,6 +66,18 @@ void WriteGccDepfile(cmsys::ofstream& fout, const cmLocalGenerator& lg,
}
fout << '\n';
}
+
+ if (format == cmDepfileFormat::MakeDepfile) {
+ // In this case, phony targets must be added for all dependencies
+ fout << "\n";
+ for (auto const& dep : content) {
+ for (auto const& path : dep.paths) {
+ fout << "\n";
+ WriteFilenameGcc(fout, formatPath(path));
+ fout << ":\n";
+ }
+ }
+ }
}
// tlog format : always windows paths on Windows regardless the generator
@@ -122,7 +135,8 @@ bool cmTransformDepfile(cmDepfileFormat format, const cmLocalGenerator& lg,
}
switch (format) {
case cmDepfileFormat::GccDepfile:
- WriteGccDepfile(fout, lg, content);
+ case cmDepfileFormat::MakeDepfile:
+ WriteDepfile(format, fout, lg, content);
break;
case cmDepfileFormat::VsTlog:
WriteVsTlog(fout, lg, content);