diff options
author | Marc Chevrier <marc.chevrier@gmail.com> | 2021-04-15 12:13:57 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2021-04-15 16:17:31 (GMT) |
commit | d67cc4882d54a18abbd5d01365ce1fc72d702a0e (patch) | |
tree | d609494ba1f13292a45d92630b47c4094ad2cc82 /Source/cmCustomCommandGenerator.cxx | |
parent | 498b916cdd96330baa33bc10667b43cbb78674d4 (diff) | |
download | CMake-d67cc4882d54a18abbd5d01365ce1fc72d702a0e.zip CMake-d67cc4882d54a18abbd5d01365ce1fc72d702a0e.tar.gz CMake-d67cc4882d54a18abbd5d01365ce1fc72d702a0e.tar.bz2 |
Xcode: Add support of DEPFILE for add_custom_command
Issue: #20286
Diffstat (limited to 'Source/cmCustomCommandGenerator.cxx')
-rw-r--r-- | Source/cmCustomCommandGenerator.cxx | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/Source/cmCustomCommandGenerator.cxx b/Source/cmCustomCommandGenerator.cxx index 4705443..7659792 100644 --- a/Source/cmCustomCommandGenerator.cxx +++ b/Source/cmCustomCommandGenerator.cxx @@ -151,7 +151,9 @@ std::string EvaluateDepfile(std::string const& path, cmCustomCommandGenerator::cmCustomCommandGenerator( cmCustomCommand const& cc, std::string config, cmLocalGenerator* lg, - bool transformDepfile, cm::optional<std::string> crossConfig) + bool transformDepfile, cm::optional<std::string> crossConfig, + std::function<std::string(const std::string&, const std::string&)> + computeInternalDepfile) : CC(&cc) , OutputConfig(crossConfig ? *crossConfig : config) , CommandConfig(std::move(config)) @@ -159,7 +161,15 @@ cmCustomCommandGenerator::cmCustomCommandGenerator( , OldStyle(cc.GetEscapeOldStyle()) , MakeVars(cc.GetEscapeAllowMakeVars()) , EmulatorsWithArguments(cc.GetCommandLines().size()) + , ComputeInternalDepfile(std::move(computeInternalDepfile)) { + if (!this->ComputeInternalDepfile) { + this->ComputeInternalDepfile = + [this](const std::string& cfg, const std::string& file) -> std::string { + return this->GetInternalDepfileName(cfg, file); + }; + } + cmGeneratorExpression ge(cc.GetBacktrace()); const cmCustomCommandLines& cmdlines = this->CC->GetCommandLines(); @@ -413,13 +423,9 @@ std::string cmCustomCommandGenerator::GetFullDepfile() const return cmSystemTools::CollapseFullPath(depfile); } -std::string cmCustomCommandGenerator::GetInternalDepfile() const +std::string cmCustomCommandGenerator::GetInternalDepfileName( + const std::string& /*config*/, const std::string& depfile) { - std::string depfile = this->GetFullDepfile(); - if (depfile.empty()) { - return ""; - } - cmCryptoHash hash(cmCryptoHash::AlgoSHA256); std::string extension; switch (*this->LG->GetGlobalGenerator()->DepfileFormat()) { @@ -434,6 +440,16 @@ std::string cmCustomCommandGenerator::GetInternalDepfile() const hash.HashString(depfile), extension); } +std::string cmCustomCommandGenerator::GetInternalDepfile() const +{ + std::string depfile = this->GetFullDepfile(); + if (depfile.empty()) { + return ""; + } + + return this->ComputeInternalDepfile(this->OutputConfig, depfile); +} + const char* cmCustomCommandGenerator::GetComment() const { return this->CC->GetComment(); |