summaryrefslogtreecommitdiff
path: root/Source/cmGlobalNinjaGenerator.cxx
diff options
context:
space:
mode:
authorKulla Christoph <christoph.kulla@de.bosch.com>2016-08-05 14:39:31 +0200
committerBrad King <brad.king@kitware.com>2016-08-30 09:05:18 -0400
commit048d1adb4ede50e49dce00873a5961e424e149f9 (patch)
tree2f7ec3c0e5a773820c8cd74efa90c12124bbcce3 /Source/cmGlobalNinjaGenerator.cxx
parent98caa14cc84cc659c2c5b51f84c6547b57c89c30 (diff)
downloadcmake-048d1adb4ede50e49dce00873a5961e424e149f9.tar.gz
add_custom_command: Add DEPFILE option for Ninja
Provide a way for custom commands to inform the ninja build tool about their implicit dependencies. For now simply make use of the option an error on other generators. Closes: #15479
Diffstat (limited to 'Source/cmGlobalNinjaGenerator.cxx')
-rw-r--r--Source/cmGlobalNinjaGenerator.cxx10
1 files changed, 6 insertions, 4 deletions
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx
index 2b83479015..9bc8246b7e 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -251,8 +251,8 @@ void cmGlobalNinjaGenerator::AddCustomCommandRule()
void cmGlobalNinjaGenerator::WriteCustomCommandBuild(
const std::string& command, const std::string& description,
- const std::string& comment, bool uses_terminal, bool restat,
- const cmNinjaDeps& outputs, const cmNinjaDeps& deps,
+ const std::string& comment, const std::string& depfile, bool uses_terminal,
+ bool restat, const cmNinjaDeps& outputs, const cmNinjaDeps& deps,
const cmNinjaDeps& orderOnly)
{
std::string cmd = command;
@@ -273,7 +273,9 @@ void cmGlobalNinjaGenerator::WriteCustomCommandBuild(
if (uses_terminal && SupportsConsolePool()) {
vars["pool"] = "console";
}
-
+ if (!depfile.empty()) {
+ vars["depfile"] = depfile;
+ }
this->WriteBuild(*this->BuildFileStream, comment, "CUSTOM_COMMAND", outputs,
deps, cmNinjaDeps(), orderOnly, vars);
@@ -839,7 +841,7 @@ void cmGlobalNinjaGenerator::WriteAssumedSourceDependencies()
std::copy(i->second.begin(), i->second.end(), std::back_inserter(deps));
WriteCustomCommandBuild(/*command=*/"", /*description=*/"",
"Assume dependencies for generated source file.",
- /*uses_terminal*/ false,
+ /*depfile*/ "", /*uses_terminal*/ false,
/*restat*/ true, cmNinjaDeps(1, i->first), deps);
}
}