mirror of
https://github.com/Kitware/CMake.git
synced 2026-04-21 21:58:50 -05:00
Genex: Move genex expansion of paths into AppendPaths utility
Refactored internals of cmCustomCommandGenerator to make processing of path lists (evaluation of generator expressions and expansion into a list) available as AppendPaths utility function to be used for byproduct generator expression support.
This commit is contained in:
@@ -17,6 +17,26 @@
|
|||||||
#include <memory>
|
#include <memory>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
void AppendPaths(const std::vector<std::string>& inputs,
|
||||||
|
cmGeneratorExpression& ge, cmLocalGenerator* lg,
|
||||||
|
std::string const& config, std::vector<std::string>& output)
|
||||||
|
{
|
||||||
|
for (std::string const& in : inputs) {
|
||||||
|
std::unique_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(in);
|
||||||
|
std::vector<std::string> result =
|
||||||
|
cmExpandedList(cge->Evaluate(lg, config));
|
||||||
|
for (std::string& it : result) {
|
||||||
|
cmSystemTools::ConvertToUnixSlashes(it);
|
||||||
|
if (cmSystemTools::FileIsFullPath(it)) {
|
||||||
|
it = cmSystemTools::CollapseFullPath(it);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
cmAppend(output, result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
cmCustomCommandGenerator::cmCustomCommandGenerator(cmCustomCommand const& cc,
|
cmCustomCommandGenerator::cmCustomCommandGenerator(cmCustomCommand const& cc,
|
||||||
std::string config,
|
std::string config,
|
||||||
cmLocalGenerator* lg)
|
cmLocalGenerator* lg)
|
||||||
@@ -46,25 +66,14 @@ cmCustomCommandGenerator::cmCustomCommandGenerator(cmCustomCommand const& cc,
|
|||||||
// lists on an empty command may have left this empty.
|
// lists on an empty command may have left this empty.
|
||||||
// FIXME: Should we define behavior for removing empty commands?
|
// FIXME: Should we define behavior for removing empty commands?
|
||||||
if (argv.empty()) {
|
if (argv.empty()) {
|
||||||
argv.push_back(std::string());
|
argv.emplace_back();
|
||||||
}
|
}
|
||||||
|
|
||||||
this->CommandLines.push_back(std::move(argv));
|
this->CommandLines.push_back(std::move(argv));
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::string> depends = this->CC.GetDepends();
|
AppendPaths(cc.GetDepends(), *this->GE, this->LG, this->Config,
|
||||||
for (std::string const& d : depends) {
|
this->Depends);
|
||||||
std::unique_ptr<cmCompiledGeneratorExpression> cge = this->GE->Parse(d);
|
|
||||||
std::vector<std::string> result =
|
|
||||||
cmExpandedList(cge->Evaluate(this->LG, this->Config));
|
|
||||||
for (std::string& it : result) {
|
|
||||||
cmSystemTools::ConvertToUnixSlashes(it);
|
|
||||||
if (cmSystemTools::FileIsFullPath(it)) {
|
|
||||||
it = cmSystemTools::CollapseFullPath(it);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
cmAppend(this->Depends, result);
|
|
||||||
}
|
|
||||||
|
|
||||||
const std::string& workingdirectory = this->CC.GetWorkingDirectory();
|
const std::string& workingdirectory = this->CC.GetWorkingDirectory();
|
||||||
if (!workingdirectory.empty()) {
|
if (!workingdirectory.empty()) {
|
||||||
|
|||||||
Reference in New Issue
Block a user