mirror of
https://gitlab.kitware.com/cmake/cmake.git
synced 2026-09-25 04:09:36 +03:00
Merge topic 'Sources-various-enhancements'
bc4e849e50cmValue: introduce constants cmValue::True and cmValue::Falsea570ee4c8fcmPlaceHolderExpander: Add recognition of genexb53f05cd8ccmArgumentParser: enhance multi command managementa53691b73acmCustomCommand: reduce raw pointer usage Acked-by: Kitware Robot <kwrobot@kitware.com> Tested-by: buildbot <buildbot@kitware.com> Merge-request: !12506
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
#include <utility>
|
||||
|
||||
#include <cm/memory>
|
||||
#include <cm/optional>
|
||||
#include <cmext/string_view>
|
||||
|
||||
#include "cmCustomCommand.h"
|
||||
@@ -44,8 +45,7 @@ bool cmAddCustomCommandCommand(std::vector<std::string> const& args,
|
||||
std::string depfile;
|
||||
std::string job_pool;
|
||||
std::string job_server_aware;
|
||||
std::string comment_buffer;
|
||||
char const* comment = nullptr;
|
||||
cm::optional<std::string> comment;
|
||||
std::vector<std::string> depends;
|
||||
std::vector<std::string> outputs;
|
||||
std::vector<std::string> output;
|
||||
@@ -369,7 +369,7 @@ bool cmAddCustomCommandCommand(std::vector<std::string> const& args,
|
||||
byproducts.push_back(filename);
|
||||
break;
|
||||
case doing_comment:
|
||||
if (!comment_buffer.empty()) {
|
||||
if (comment && !comment->empty()) {
|
||||
std::string const msg =
|
||||
"COMMENT requires exactly one argument, but multiple values "
|
||||
"or COMMENT keywords have been given.";
|
||||
@@ -381,8 +381,7 @@ bool cmAddCustomCommandCommand(std::vector<std::string> const& args,
|
||||
mf.IssuePolicyWarning(cmPolicies::CMP0175, msg);
|
||||
}
|
||||
}
|
||||
comment_buffer = copy;
|
||||
comment = comment_buffer.c_str();
|
||||
comment = copy;
|
||||
break;
|
||||
default:
|
||||
status.SetError("Wrong syntax. Unknown type of argument.");
|
||||
@@ -477,7 +476,7 @@ bool cmAddCustomCommandCommand(std::vector<std::string> const& args,
|
||||
cc->SetByproducts(byproducts);
|
||||
cc->SetCommandLines(commandLines);
|
||||
cc->SetComment(comment);
|
||||
cc->SetWorkingDirectory(working.c_str());
|
||||
cc->SetWorkingDirectory(working);
|
||||
cc->SetEscapeOldStyle(!verbatim);
|
||||
cc->SetUsesTerminal(uses_terminal);
|
||||
cc->SetDepfile(depfile);
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include <utility>
|
||||
|
||||
#include <cm/memory>
|
||||
#include <cm/optional>
|
||||
|
||||
#include "cmCustomCommand.h"
|
||||
#include "cmCustomCommandLines.h"
|
||||
@@ -50,8 +51,7 @@ bool cmAddCustomTargetCommand(std::vector<std::string> const& args,
|
||||
bool verbatim = false;
|
||||
bool uses_terminal = false;
|
||||
bool command_expand_lists = false;
|
||||
std::string comment_buffer;
|
||||
char const* comment = nullptr;
|
||||
cm::optional<std::string> comment;
|
||||
std::vector<std::string> sources;
|
||||
std::string job_pool;
|
||||
std::string job_server_aware;
|
||||
@@ -143,8 +143,7 @@ bool cmAddCustomTargetCommand(std::vector<std::string> const& args,
|
||||
depends.push_back(std::move(dep));
|
||||
} break;
|
||||
case doing_comment:
|
||||
comment_buffer = copy;
|
||||
comment = comment_buffer.c_str();
|
||||
comment = copy;
|
||||
break;
|
||||
case doing_source:
|
||||
sources.push_back(copy);
|
||||
@@ -209,7 +208,7 @@ bool cmAddCustomTargetCommand(std::vector<std::string> const& args,
|
||||
|
||||
// Add the utility target to the makefile.
|
||||
auto cc = cm::make_unique<cmCustomCommand>();
|
||||
cc->SetWorkingDirectory(working_directory.c_str());
|
||||
cc->SetWorkingDirectory(working_directory);
|
||||
cc->SetByproducts(byproducts);
|
||||
cc->SetDepends(depends);
|
||||
cc->SetCommandLines(commandLines);
|
||||
|
||||
@@ -127,7 +127,8 @@ void Instance::Bind(NonEmpty<std::vector<std::string>>& val)
|
||||
ExpectAtLeast{ 1 });
|
||||
}
|
||||
|
||||
void Instance::Bind(std::vector<std::vector<std::string>>& multiVal)
|
||||
void Instance::Bind(
|
||||
MaybeEmpty<std::vector<std::vector<std::string>>>& multiVal)
|
||||
{
|
||||
multiVal.emplace_back();
|
||||
std::vector<std::string>& val = multiVal.back();
|
||||
@@ -139,6 +140,18 @@ void Instance::Bind(std::vector<std::vector<std::string>>& multiVal)
|
||||
ExpectAtLeast{ 0 });
|
||||
}
|
||||
|
||||
void Instance::Bind(NonEmpty<std::vector<std::vector<std::string>>>& multiVal)
|
||||
{
|
||||
multiVal.emplace_back();
|
||||
std::vector<std::string>& val = multiVal.back();
|
||||
this->Bind(
|
||||
[&val](cm::string_view arg) -> Continue {
|
||||
val.emplace_back(arg);
|
||||
return Continue::Yes;
|
||||
},
|
||||
ExpectAtLeast{ 1 });
|
||||
}
|
||||
|
||||
void Instance::Consume(cm::string_view arg)
|
||||
{
|
||||
ParserState& state = this->GetState();
|
||||
|
||||
@@ -228,7 +228,8 @@ public:
|
||||
void Bind(Maybe<std::string>& val);
|
||||
void Bind(MaybeEmpty<std::vector<std::string>>& val);
|
||||
void Bind(NonEmpty<std::vector<std::string>>& val);
|
||||
void Bind(std::vector<std::vector<std::string>>& val);
|
||||
void Bind(MaybeEmpty<std::vector<std::vector<std::string>>>& val);
|
||||
void Bind(NonEmpty<std::vector<std::vector<std::string>>>& val);
|
||||
|
||||
template <typename U>
|
||||
void Bind(NonEmpty<std::vector<std::pair<std::string, U>>>& val,
|
||||
|
||||
@@ -77,16 +77,14 @@ void cmCustomCommand::SetCommandLines(cmCustomCommandLines commandLines)
|
||||
this->CommandLines = std::move(commandLines);
|
||||
}
|
||||
|
||||
char const* cmCustomCommand::GetComment() const
|
||||
cm::optional<std::string> const& cmCustomCommand::GetComment() const
|
||||
{
|
||||
char const* no_comment = nullptr;
|
||||
return this->HaveComment ? this->Comment.c_str() : no_comment;
|
||||
return this->Comment;
|
||||
}
|
||||
|
||||
void cmCustomCommand::SetComment(char const* comment)
|
||||
void cmCustomCommand::SetComment(cm::optional<std::string> comment)
|
||||
{
|
||||
this->Comment = comment ? comment : "";
|
||||
this->HaveComment = (comment != nullptr);
|
||||
this->Comment = std::move(comment);
|
||||
}
|
||||
|
||||
void cmCustomCommand::AppendCommands(cmCustomCommandLines const& commandLines)
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include <cm/optional>
|
||||
|
||||
#include "cmCustomCommandLines.h"
|
||||
#include "cmListFileCache.h"
|
||||
#include "cmPolicies.h"
|
||||
@@ -50,9 +52,9 @@ public:
|
||||
return this->WorkingDirectory;
|
||||
}
|
||||
|
||||
void SetWorkingDirectory(char const* workingDirectory)
|
||||
void SetWorkingDirectory(std::string const& workingDirectory)
|
||||
{
|
||||
this->WorkingDirectory = (workingDirectory ? workingDirectory : "");
|
||||
this->WorkingDirectory = workingDirectory;
|
||||
}
|
||||
|
||||
/** Get the list of command lines. */
|
||||
@@ -60,8 +62,8 @@ public:
|
||||
void SetCommandLines(cmCustomCommandLines commandLines);
|
||||
|
||||
/** Get the comment string for the command. */
|
||||
char const* GetComment() const;
|
||||
void SetComment(char const* comment);
|
||||
cm::optional<std::string> const& GetComment() const;
|
||||
void SetComment(cm::optional<std::string> comment);
|
||||
|
||||
/** Get a value indicating if the command uses UTF-8 output pipes. */
|
||||
bool GetStdPipesUTF8() const { return this->StdPipesUTF8; }
|
||||
@@ -148,13 +150,12 @@ private:
|
||||
cmListFileBacktrace Backtrace;
|
||||
cmImplicitDependsList ImplicitDepends;
|
||||
std::string Target;
|
||||
std::string Comment;
|
||||
cm::optional<std::string> Comment;
|
||||
std::string WorkingDirectory;
|
||||
std::string Depfile;
|
||||
std::string JobPool;
|
||||
std::string Role;
|
||||
bool JobserverAware = false;
|
||||
bool HaveComment = false;
|
||||
bool EscapeAllowMakeVars = false;
|
||||
bool EscapeOldStyle = true;
|
||||
bool UsesTerminal = false;
|
||||
|
||||
@@ -152,7 +152,7 @@ std::string EvaluateDepfile(std::string const& path,
|
||||
return cge->Evaluate(lg, config);
|
||||
}
|
||||
|
||||
std::string EvaluateComment(char const* comment,
|
||||
std::string EvaluateComment(std::string const& comment,
|
||||
cmGeneratorExpression const& ge,
|
||||
cmLocalGenerator* lg, std::string const& config)
|
||||
{
|
||||
@@ -484,12 +484,12 @@ std::string cmCustomCommandGenerator::GetInternalDepfile() const
|
||||
|
||||
cm::optional<std::string> cmCustomCommandGenerator::GetComment() const
|
||||
{
|
||||
char const* comment = this->CC->GetComment();
|
||||
if (!comment) {
|
||||
if (!this->CC->GetComment()) {
|
||||
return cm::nullopt;
|
||||
}
|
||||
if (!*comment) {
|
||||
return std::string();
|
||||
std::string const& comment = this->CC->GetComment().value();
|
||||
if (comment.empty()) {
|
||||
return comment;
|
||||
}
|
||||
|
||||
cmGeneratorExpression ge(*this->LG->GetCMakeInstance(),
|
||||
|
||||
@@ -79,7 +79,7 @@ bool cmExecuteProcessCommand(std::vector<std::string> const& args,
|
||||
|
||||
struct Arguments : public ArgumentParser::ParseResult
|
||||
{
|
||||
std::vector<std::vector<std::string>> Commands;
|
||||
ArgumentParser::MaybeEmpty<std::vector<std::vector<std::string>>> Commands;
|
||||
std::string OutputVariable;
|
||||
std::string ErrorVariable;
|
||||
std::string ResultVariable;
|
||||
|
||||
@@ -487,8 +487,10 @@ static bool HandleSetupMode(std::vector<std::string> const& args,
|
||||
{
|
||||
ArgumentParser::NonEmpty<std::string> ExportSetName;
|
||||
ArgumentParser::NonEmpty<std::string> CxxModulesDirectory;
|
||||
std::vector<std::vector<std::string>> PackageDependencyArgs;
|
||||
std::vector<std::vector<std::string>> TargetArgs;
|
||||
ArgumentParser::MaybeEmpty<std::vector<std::vector<std::string>>>
|
||||
PackageDependencyArgs;
|
||||
ArgumentParser::MaybeEmpty<std::vector<std::vector<std::string>>>
|
||||
TargetArgs;
|
||||
};
|
||||
|
||||
auto parser = cmArgumentParser<SetupArguments>{};
|
||||
|
||||
@@ -3614,7 +3614,7 @@ void ModuleCompilationDatabaseCommandAction::operator()(
|
||||
|
||||
cc->SetBacktrace(lfbt);
|
||||
cc->SetCommandLines(command_lines);
|
||||
cc->SetWorkingDirectory(lg.GetBinaryDirectory().c_str());
|
||||
cc->SetWorkingDirectory(lg.GetBinaryDirectory());
|
||||
cc->SetDependsExplicitOnly(true);
|
||||
cc->SetOutputs(this->Output);
|
||||
if (!inputs.empty()) {
|
||||
@@ -3646,7 +3646,7 @@ void ModuleCompilationDatabaseTargetAction::operator()(
|
||||
std::unique_ptr<cmCustomCommand> cc)
|
||||
{
|
||||
cc->SetBacktrace(lfbt);
|
||||
cc->SetWorkingDirectory(lg.GetBinaryDirectory().c_str());
|
||||
cc->SetWorkingDirectory(lg.GetBinaryDirectory());
|
||||
std::vector<std::string> target_inputs;
|
||||
target_inputs.emplace_back(this->Output);
|
||||
cc->SetDepends(target_inputs);
|
||||
@@ -3698,7 +3698,7 @@ bool cmGlobalGenerator::AddBuildDatabaseTargets()
|
||||
|
||||
static cm::static_string_view TargetPrefix = "cmake_build_database"_s;
|
||||
auto AddMergeTarget =
|
||||
[&mf](std::string const& name, char const* comment,
|
||||
[&mf](std::string const& name, std::string const& comment,
|
||||
std::string const& output,
|
||||
std::function<std::vector<std::string>()> inputs) {
|
||||
// Add the custom command.
|
||||
@@ -3732,13 +3732,13 @@ bool cmGlobalGenerator::AddBuildDatabaseTargets()
|
||||
lang, ".json");
|
||||
mf->GetOrCreateGeneratedSource(output);
|
||||
AddMergeTarget(
|
||||
cmStrCat(TargetPrefix, '-', lang), comment.c_str(), output,
|
||||
cmStrCat(TargetPrefix, '-', lang), comment, output,
|
||||
[this, lang]() { return this->PerLanguageModuleDbs[lang]; });
|
||||
all_lang_paths.emplace_back(std::move(output));
|
||||
}
|
||||
|
||||
// Add the overall target.
|
||||
auto const* comment = "Combining module command databases";
|
||||
std::string comment{ "Combining module command databases" };
|
||||
auto output =
|
||||
cmStrCat(mf->GetHomeOutputDirectory(), "/build_database.json");
|
||||
mf->GetOrCreateGeneratedSource(output);
|
||||
@@ -3758,8 +3758,8 @@ bool cmGlobalGenerator::AddBuildDatabaseTargets()
|
||||
auto output = cmStrCat(mf->GetHomeOutputDirectory(), "/build_database_",
|
||||
lang, '_', config, ".json");
|
||||
mf->GetOrCreateGeneratedSource(output);
|
||||
AddMergeTarget(cmStrCat(TargetPrefix, '-', lang, '-', config),
|
||||
comment.c_str(), output, [this, config, lang]() {
|
||||
AddMergeTarget(cmStrCat(TargetPrefix, '-', lang, '-', config), comment,
|
||||
output, [this, config, lang]() {
|
||||
return this->PerConfigModuleDbs[config][lang];
|
||||
});
|
||||
all_config_paths.emplace_back(std::move(output));
|
||||
@@ -3770,8 +3770,8 @@ bool cmGlobalGenerator::AddBuildDatabaseTargets()
|
||||
auto output = cmStrCat(mf->GetHomeOutputDirectory(), "/build_database_",
|
||||
config, ".json");
|
||||
mf->GetOrCreateGeneratedSource(output);
|
||||
AddMergeTarget(cmStrCat(TargetPrefix, '-', config), comment.c_str(),
|
||||
output, [all_config_paths]() { return all_config_paths; });
|
||||
AddMergeTarget(cmStrCat(TargetPrefix, '-', config), comment, output,
|
||||
[all_config_paths]() { return all_config_paths; });
|
||||
}
|
||||
|
||||
// NMC considerations
|
||||
@@ -3783,13 +3783,13 @@ bool cmGlobalGenerator::AddBuildDatabaseTargets()
|
||||
lang, ".json");
|
||||
mf->GetOrCreateGeneratedSource(output);
|
||||
AddMergeTarget(
|
||||
cmStrCat(TargetPrefix, '-', lang), comment.c_str(), output,
|
||||
cmStrCat(TargetPrefix, '-', lang), comment, output,
|
||||
[this, lang]() { return this->PerLanguageModuleDbs[lang]; });
|
||||
all_config_paths.emplace_back(std::move(output));
|
||||
}
|
||||
|
||||
// Add the overall target.
|
||||
auto const* comment = "Combining all module command databases";
|
||||
std::string comment{ "Combining all module command databases" };
|
||||
auto output = cmStrCat(mf->GetHomeOutputDirectory(), "/build_database.json");
|
||||
mf->GetOrCreateGeneratedSource(output);
|
||||
AddMergeTarget(std::string(TargetPrefix), comment, output,
|
||||
@@ -3844,7 +3844,7 @@ void cmGlobalGenerator::CreateGlobalTarget(GlobalTargetInfo const& gti,
|
||||
// Store the custom command in the target.
|
||||
cmCustomCommand cc;
|
||||
cc.SetCommandLines(gti.CommandLines);
|
||||
cc.SetWorkingDirectory(gti.WorkingDir.c_str());
|
||||
cc.SetWorkingDirectory(gti.WorkingDir);
|
||||
cc.SetStdPipesUTF8(gti.StdPipesUTF8);
|
||||
cc.SetUsesTerminal(gti.UsesTerminal);
|
||||
cc.SetRole(gti.Role);
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include <utility>
|
||||
|
||||
#include <cm/memory>
|
||||
#include <cm/optional>
|
||||
#include <cm/string>
|
||||
#include <cm/string_view>
|
||||
#include <cmext/algorithm>
|
||||
|
||||
@@ -829,7 +829,7 @@ void cmGlobalXCodeGenerator::AddExtraTargets(
|
||||
cc = cm::make_unique<cmCustomCommand>();
|
||||
cc->SetCommandLines(legacyDependHelperCommandLines);
|
||||
cc->SetComment("Depend check for xcode");
|
||||
cc->SetWorkingDirectory(legacyDependHelperDir.c_str());
|
||||
cc->SetWorkingDirectory(legacyDependHelperDir);
|
||||
gen->AddCustomCommandToTarget(
|
||||
target->GetName(), cmCustomCommandType::POST_BUILD, std::move(cc),
|
||||
cmObjectLibraryCommands::Accept);
|
||||
|
||||
@@ -1016,7 +1016,7 @@ bool HandleTargetsMode(std::vector<std::string> const& args,
|
||||
ArgumentParser::MaybeEmpty<std::vector<std::string>> PublicHeader;
|
||||
ArgumentParser::MaybeEmpty<std::vector<std::string>> Resource;
|
||||
ArgumentParser::MaybeEmpty<std::vector<std::string>> CxxModulesBmi;
|
||||
std::vector<std::vector<std::string>> FileSets;
|
||||
ArgumentParser::MaybeEmpty<std::vector<std::vector<std::string>>> FileSets;
|
||||
};
|
||||
|
||||
static auto const argHelper =
|
||||
|
||||
@@ -3069,7 +3069,7 @@ void cmLocalGenerator::CopyPchCompilePdb(
|
||||
|
||||
auto cc = cm::make_unique<cmCustomCommand>();
|
||||
cc->SetCommandLines(commandLines);
|
||||
cc->SetComment(comment.c_str());
|
||||
cc->SetComment(comment);
|
||||
cc->SetStdPipesUTF8(true);
|
||||
cc->AppendDepends(
|
||||
{ reuseTarget->GetPchFile(config, language), copy_script });
|
||||
|
||||
@@ -272,7 +272,7 @@ cmSourceFile* cmLocalVisualStudio7Generator::CreateVCProjBuildRule()
|
||||
cc->SetMainDependency(makefileIn);
|
||||
cc->SetDepends(listFiles);
|
||||
cc->SetCommandLines(commandLines);
|
||||
cc->SetComment(comment.c_str());
|
||||
cc->SetComment(comment);
|
||||
cc->SetEscapeOldStyle(false);
|
||||
cc->SetStdPipesUTF8(true);
|
||||
cc->SetUsesTerminal(true);
|
||||
|
||||
@@ -1520,7 +1520,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement(
|
||||
true, config);
|
||||
localGen.AppendCustomCommandLines(ccg, *cmdLineLists[i]);
|
||||
if (cc.GetComment()) {
|
||||
auto cge = ge.Parse(cc.GetComment());
|
||||
auto cge = ge.Parse(cc.GetComment().value());
|
||||
cmdComments[i]->emplace_back(
|
||||
cge->Evaluate(this->GetLocalGenerator(), config));
|
||||
}
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include <cm/optional>
|
||||
|
||||
#include "cmCustomCommand.h"
|
||||
#include "cmCustomCommandGenerator.h"
|
||||
#include "cmGeneratedFileStream.h"
|
||||
@@ -96,7 +98,7 @@ void cmNinjaUtilityTargetGenerator::WriteUtilBuildStatements(
|
||||
if (!commandDesc.empty()) {
|
||||
commandDesc += "; ";
|
||||
}
|
||||
auto cge = ge.Parse(ci.GetComment());
|
||||
auto cge = ge.Parse(ci.GetComment().value());
|
||||
commandDesc += cge->Evaluate(this->GetLocalGenerator(), config);
|
||||
}
|
||||
util_outputs.Add(ccg.GetByproducts());
|
||||
|
||||
@@ -4,7 +4,8 @@
|
||||
|
||||
#include "cmsys/String.h"
|
||||
|
||||
std::string& cmPlaceholderExpander::ExpandVariables(std::string& s)
|
||||
std::string& cmPlaceholderExpander::ExpandVariables(std::string& s,
|
||||
HandleGenex handleGenex)
|
||||
{
|
||||
std::string::size_type start = s.find('<');
|
||||
// no variables to expand
|
||||
@@ -14,6 +15,13 @@ std::string& cmPlaceholderExpander::ExpandVariables(std::string& s)
|
||||
std::string::size_type pos = 0;
|
||||
std::string expandedInput;
|
||||
while (start != std::string::npos && start < s.size() - 2) {
|
||||
if (handleGenex == HandleGenex::Yes && start != 0 && s[start - 1] == '$') {
|
||||
// this is a generator expression
|
||||
// skip it and try to find the next < in the string
|
||||
start = s.find('<', start + 1);
|
||||
continue;
|
||||
}
|
||||
|
||||
std::string::size_type end = s.find('>', start);
|
||||
// if we find a < with no > we are done
|
||||
if (end == std::string::npos) {
|
||||
|
||||
@@ -10,9 +10,16 @@
|
||||
class cmPlaceholderExpander
|
||||
{
|
||||
public:
|
||||
enum class HandleGenex
|
||||
{
|
||||
No,
|
||||
Yes
|
||||
};
|
||||
|
||||
virtual ~cmPlaceholderExpander() = default;
|
||||
|
||||
std::string& ExpandVariables(std::string& string);
|
||||
std::string& ExpandVariables(std::string& string,
|
||||
HandleGenex handleGenex = HandleGenex::No);
|
||||
|
||||
protected:
|
||||
virtual std::string ExpandVariable(std::string const& variable) = 0;
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include <utility>
|
||||
|
||||
#include <cm/memory>
|
||||
#include <cm/optional>
|
||||
#include <cm/string_view>
|
||||
|
||||
#include "cmCustomCommand.h"
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include <utility>
|
||||
|
||||
#include <cm/memory>
|
||||
#include <cm/optional>
|
||||
|
||||
#include "cmCustomCommand.h"
|
||||
#include "cmDiagnostics.h"
|
||||
@@ -171,9 +172,9 @@ void cmQtAutoGenGlobalInitializer::GetOrCreateGlobalTarget(
|
||||
|
||||
// Create utility target
|
||||
auto cc = cm::make_unique<cmCustomCommand>();
|
||||
cc->SetWorkingDirectory(makefile->GetHomeOutputDirectory().c_str());
|
||||
cc->SetWorkingDirectory(makefile->GetHomeOutputDirectory());
|
||||
cc->SetEscapeOldStyle(false);
|
||||
cc->SetComment(comment.c_str());
|
||||
cc->SetComment(comment);
|
||||
cmTarget* target = localGen->AddUtilityCommand(name, true, std::move(cc));
|
||||
localGen->AddGeneratorTarget(
|
||||
cm::make_unique<cmGeneratorTarget>(target, localGen));
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#include <cm/algorithm>
|
||||
#include <cm/iterator>
|
||||
#include <cm/memory>
|
||||
#include <cm/optional>
|
||||
#include <cm/string_view>
|
||||
#include <cmext/algorithm>
|
||||
#include <cmext/string_view>
|
||||
@@ -1593,7 +1594,7 @@ bool cmQtAutoGenInitializer::InitAutogenTarget()
|
||||
cc->SetOutputs(timestampFileGenex);
|
||||
cc->SetDepends(uicDependencies);
|
||||
cc->SetComment("");
|
||||
cc->SetWorkingDirectory(this->Dir.Work.c_str());
|
||||
cc->SetWorkingDirectory(this->Dir.Work);
|
||||
cc->SetEscapeOldStyle(false);
|
||||
cc->SetStdPipesUTF8(stdPipesUTF8);
|
||||
this->LocalGen->AddCustomCommandToOutput(std::move(cc));
|
||||
@@ -1607,9 +1608,9 @@ bool cmQtAutoGenInitializer::InitAutogenTarget()
|
||||
cmCustomCommand cc;
|
||||
cc.SetByproducts(autogenByproducts);
|
||||
cc.SetCommandLines(commandLines);
|
||||
cc.SetComment(autogenComment.c_str());
|
||||
cc.SetComment(autogenComment);
|
||||
cc.SetBacktrace(this->Makefile->GetBacktrace());
|
||||
cc.SetWorkingDirectory(this->Dir.Work.c_str());
|
||||
cc.SetWorkingDirectory(this->Dir.Work);
|
||||
cc.SetStdPipesUTF8(stdPipesUTF8);
|
||||
cc.SetEscapeOldStyle(false);
|
||||
cc.SetEscapeAllowMakeVars(true);
|
||||
@@ -1671,7 +1672,7 @@ bool cmQtAutoGenInitializer::InitAutogenTarget()
|
||||
cmStrCat(this->GenTarget->GetName(), "_autogen_timestamp_deps");
|
||||
|
||||
auto cc = cm::make_unique<cmCustomCommand>();
|
||||
cc->SetWorkingDirectory(this->Dir.Work.c_str());
|
||||
cc->SetWorkingDirectory(this->Dir.Work);
|
||||
cc->SetDepends(dependencies);
|
||||
cc->SetEscapeOldStyle(false);
|
||||
timestampTarget = this->LocalGen->AddUtilityCommand(
|
||||
@@ -1742,8 +1743,8 @@ bool cmQtAutoGenInitializer::InitAutogenTarget()
|
||||
cc->SetByproducts(timestampByproducts);
|
||||
cc->SetDepends(dependencies);
|
||||
cc->SetCommandLines(commandLines);
|
||||
cc->SetComment(autogenComment.c_str());
|
||||
cc->SetWorkingDirectory(this->Dir.Work.c_str());
|
||||
cc->SetComment(autogenComment);
|
||||
cc->SetWorkingDirectory(this->Dir.Work);
|
||||
cc->SetEscapeOldStyle(false);
|
||||
cc->SetDepfile(depFile);
|
||||
cc->SetStdPipesUTF8(stdPipesUTF8);
|
||||
@@ -1763,12 +1764,12 @@ bool cmQtAutoGenInitializer::InitAutogenTarget()
|
||||
} else {
|
||||
// Create autogen target
|
||||
auto cc = cm::make_unique<cmCustomCommand>();
|
||||
cc->SetWorkingDirectory(this->Dir.Work.c_str());
|
||||
cc->SetWorkingDirectory(this->Dir.Work);
|
||||
cc->SetByproducts(autogenByproducts);
|
||||
cc->SetDepends(dependencies);
|
||||
cc->SetCommandLines(commandLines);
|
||||
cc->SetEscapeOldStyle(false);
|
||||
cc->SetComment(autogenComment.c_str());
|
||||
cc->SetComment(autogenComment);
|
||||
cmTarget* autogenTarget = this->LocalGen->AddUtilityCommand(
|
||||
this->AutogenTarget.Name, true, std::move(cc));
|
||||
// Create autogen generator target
|
||||
@@ -1878,9 +1879,9 @@ bool cmQtAutoGenInitializer::InitRccTargets()
|
||||
FileProjectRelativePath(this->Makefile, qrc.QrcFile));
|
||||
|
||||
auto cc = cm::make_unique<cmCustomCommand>();
|
||||
cc->SetWorkingDirectory(this->Dir.Work.c_str());
|
||||
cc->SetWorkingDirectory(this->Dir.Work);
|
||||
cc->SetCommandLines(commandLines);
|
||||
cc->SetComment(ccComment.c_str());
|
||||
cc->SetComment(ccComment);
|
||||
cc->SetStdPipesUTF8(true);
|
||||
|
||||
if (qrc.Generated || this->Rcc.GlobalTarget) {
|
||||
|
||||
@@ -49,8 +49,6 @@ std::string const& cmSourceFile::GetExtension() const
|
||||
return this->Extension;
|
||||
}
|
||||
|
||||
std::string const propTRUE = "1";
|
||||
std::string const propFALSE = "0";
|
||||
std::string const cmSourceFile::propLANGUAGE = "LANGUAGE";
|
||||
std::string const cmSourceFile::propLOCATION = "LOCATION";
|
||||
std::string const cmSourceFile::propGENERATED = "GENERATED";
|
||||
@@ -387,9 +385,9 @@ cmValue cmSourceFile::GetPropertyForUser(std::string const& prop)
|
||||
(cmp0118 != cmPolicies::OLD && cmp0118 != cmPolicies::WARN);
|
||||
if (this->GetIsGenerated((!cmp0118new) ? CheckScope::GlobalAndLocal
|
||||
: CheckScope::Global)) {
|
||||
return cmValue(propTRUE);
|
||||
return cmValue::True;
|
||||
}
|
||||
return cmValue(propFALSE);
|
||||
return cmValue::False;
|
||||
}
|
||||
|
||||
// Perform the normal property lookup.
|
||||
|
||||
@@ -14,9 +14,9 @@
|
||||
#include "cmSystemTools.h"
|
||||
#include "cmValue.h"
|
||||
|
||||
static bool GetSourceFilePropertyGENERATED(std::string const& name,
|
||||
cmMakefile& mf,
|
||||
cmValue& propertyValue)
|
||||
namespace {
|
||||
bool GetSourceFilePropertyGENERATED(std::string const& name, cmMakefile& mf,
|
||||
cmValue& propertyValue)
|
||||
{
|
||||
// Globally set as generated?
|
||||
// Note: If the given "name" only contains a filename or a relative path
|
||||
@@ -26,13 +26,11 @@ static bool GetSourceFilePropertyGENERATED(std::string const& name,
|
||||
// generated in the build-directory. Therefore, we first check for
|
||||
// a generated file in the build-directory before we check for a
|
||||
// generated file in the source-directory.
|
||||
static std::string const sOne = "1";
|
||||
static std::string const sZero = "0";
|
||||
{
|
||||
auto file =
|
||||
cmSystemTools::CollapseFullPath(name, mf.GetCurrentBinaryDirectory());
|
||||
if (mf.GetGlobalGenerator()->IsGeneratedFile(file)) {
|
||||
propertyValue = cmValue(sOne);
|
||||
propertyValue = cmValue::True;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -40,13 +38,14 @@ static bool GetSourceFilePropertyGENERATED(std::string const& name,
|
||||
auto file =
|
||||
cmSystemTools::CollapseFullPath(name, mf.GetCurrentSourceDirectory());
|
||||
if (mf.GetGlobalGenerator()->IsGeneratedFile(file)) {
|
||||
propertyValue = cmValue(sOne);
|
||||
propertyValue = cmValue::True;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
propertyValue = cmValue(sZero);
|
||||
propertyValue = cmValue::False;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
cmGetSourceFilePropertyResult cmGetSourceFileProperty(
|
||||
std::string const& sourceName, std::string const& propertyName,
|
||||
|
||||
@@ -42,7 +42,7 @@ auto const FileSetArgsParser = cmArgumentParser<FileSetArgs>()
|
||||
|
||||
struct FileSetsArgs
|
||||
{
|
||||
std::vector<std::vector<std::string>> FileSets;
|
||||
ArgumentParser::MaybeEmpty<std::vector<std::vector<std::string>>> FileSets;
|
||||
};
|
||||
|
||||
auto const FileSetsArgsParser =
|
||||
|
||||
@@ -8,6 +8,14 @@
|
||||
|
||||
#include "cmStringAlgorithms.h"
|
||||
|
||||
namespace {
|
||||
std::string True{ "1" };
|
||||
std::string False{ "0" };
|
||||
}
|
||||
|
||||
cmValue cmValue::True{ ::True };
|
||||
cmValue cmValue::False{ ::False };
|
||||
|
||||
std::string cmValue::Empty;
|
||||
|
||||
bool cmValue::IsOn(cm::string_view value) noexcept
|
||||
|
||||
@@ -13,6 +13,9 @@
|
||||
class cmValue
|
||||
{
|
||||
public:
|
||||
static cmValue True;
|
||||
static cmValue False;
|
||||
|
||||
cmValue() noexcept = default;
|
||||
cmValue(std::nullptr_t) noexcept {}
|
||||
explicit cmValue(std::string const* value) noexcept
|
||||
|
||||
@@ -45,10 +45,14 @@ struct Result : ArgumentParser::ParseResult
|
||||
cm::optional<ArgumentParser::NonEmpty<std::vector<std::string>>> List5;
|
||||
cm::optional<ArgumentParser::MaybeEmpty<std::vector<std::string>>> List6;
|
||||
|
||||
std::vector<std::vector<std::string>> Multi1;
|
||||
std::vector<std::vector<std::string>> Multi2;
|
||||
cm::optional<std::vector<std::vector<std::string>>> Multi3;
|
||||
cm::optional<std::vector<std::vector<std::string>>> Multi4;
|
||||
ArgumentParser::MaybeEmpty<std::vector<std::vector<std::string>>> Multi1;
|
||||
ArgumentParser::MaybeEmpty<std::vector<std::vector<std::string>>> Multi2;
|
||||
cm::optional<
|
||||
ArgumentParser::MaybeEmpty<std::vector<std::vector<std::string>>>>
|
||||
Multi3;
|
||||
cm::optional<
|
||||
ArgumentParser::MaybeEmpty<std::vector<std::vector<std::string>>>>
|
||||
Multi4;
|
||||
|
||||
cm::optional<std::string> Pos0;
|
||||
cm::optional<std::string> Pos1;
|
||||
|
||||
Reference in New Issue
Block a user