Refactor: Use new SetProperty signatures
This commit is contained in:
parent
6dfa581bab
commit
dc3aa4024e
@ -140,7 +140,7 @@ bool cmAddTestCommandHandleNameMode(std::vector<std::string> const& args,
|
||||
test->SetOldStyle(false);
|
||||
test->SetCommand(command);
|
||||
if (!working_directory.empty()) {
|
||||
test->SetProperty("WORKING_DIRECTORY", working_directory.c_str());
|
||||
test->SetProperty("WORKING_DIRECTORY", working_directory);
|
||||
}
|
||||
test->SetCommandExpandLists(command_expand_lists);
|
||||
mf.AddTestGenerator(cm::make_unique<cmTestGenerator>(test, configurations));
|
||||
|
@ -1667,7 +1667,7 @@ void cmGlobalXCodeGenerator::ForceLinkerLanguage(cmGeneratorTarget* gtgt)
|
||||
fout << "\n";
|
||||
}
|
||||
if (cmSourceFile* sf = mf->GetOrCreateSource(fname)) {
|
||||
sf->SetProperty("LANGUAGE", llang.c_str());
|
||||
sf->SetProperty("LANGUAGE", llang);
|
||||
gtgt->AddSource(fname);
|
||||
}
|
||||
}
|
||||
|
@ -2553,10 +2553,10 @@ void cmLocalGenerator::AddPchDependencies(cmGeneratorTarget* target)
|
||||
continue;
|
||||
}
|
||||
|
||||
const std::string pchExtension =
|
||||
this->Makefile->GetSafeDefinition("CMAKE_PCH_EXTENSION");
|
||||
cmProp pchExtension =
|
||||
this->Makefile->GetDefinition("CMAKE_PCH_EXTENSION");
|
||||
|
||||
if (pchExtension.empty()) {
|
||||
if (pchExtension.IsEmpty()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -2647,7 +2647,7 @@ void cmLocalGenerator::AddPchDependencies(cmGeneratorTarget* target)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
pch_sf->SetProperty("PCH_EXTENSION", pchExtension.c_str());
|
||||
pch_sf->SetProperty("PCH_EXTENSION", pchExtension);
|
||||
}
|
||||
|
||||
// Add pchHeader to source files, which will
|
||||
@ -2788,7 +2788,7 @@ inline void RegisterUnitySources(cmGeneratorTarget* target, cmSourceFile* sf,
|
||||
std::string const& filename)
|
||||
{
|
||||
target->AddSourceFileToUnityBatch(sf->ResolveFullPath());
|
||||
sf->SetProperty("UNITY_SOURCE_FILE", filename.c_str());
|
||||
sf->SetProperty("UNITY_SOURCE_FILE", filename);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2986,7 +2986,7 @@ void cmLocalGenerator::AddUnityBuild(cmGeneratorTarget* target)
|
||||
auto* unity = this->GetMakefile()->GetOrCreateSource(file);
|
||||
target->AddSource(file, true);
|
||||
unity->SetProperty("SKIP_UNITY_BUILD_INCLUSION", "ON");
|
||||
unity->SetProperty("UNITY_SOURCE_FILE", file.c_str());
|
||||
unity->SetProperty("UNITY_SOURCE_FILE", file);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1444,7 +1444,7 @@ bool cmMakefile::ParseDefineFlag(std::string const& def, bool remove)
|
||||
std::string ndefs = cmJoin(cmMakeRange(defBegin, defEnd), ";");
|
||||
|
||||
// Store the new list.
|
||||
this->SetProperty("COMPILE_DEFINITIONS", ndefs.c_str());
|
||||
this->SetProperty("COMPILE_DEFINITIONS", ndefs);
|
||||
}
|
||||
} else {
|
||||
// Append the definition to the directory property.
|
||||
@ -1465,30 +1465,29 @@ void cmMakefile::InitializeFromParent(cmMakefile* parent)
|
||||
// Include transform property. There is no per-config version.
|
||||
{
|
||||
const char* prop = "IMPLICIT_DEPENDS_INCLUDE_TRANSFORM";
|
||||
this->SetProperty(prop, cmToCStr(parent->GetProperty(prop)));
|
||||
this->SetProperty(prop, parent->GetProperty(prop));
|
||||
}
|
||||
|
||||
// compile definitions property and per-config versions
|
||||
cmPolicies::PolicyStatus polSt = this->GetPolicyStatus(cmPolicies::CMP0043);
|
||||
if (polSt == cmPolicies::WARN || polSt == cmPolicies::OLD) {
|
||||
this->SetProperty("COMPILE_DEFINITIONS",
|
||||
cmToCStr(parent->GetProperty("COMPILE_DEFINITIONS")));
|
||||
parent->GetProperty("COMPILE_DEFINITIONS"));
|
||||
std::vector<std::string> configs =
|
||||
this->GetGeneratorConfigs(cmMakefile::ExcludeEmptyConfig);
|
||||
for (std::string const& config : configs) {
|
||||
std::string defPropName =
|
||||
cmStrCat("COMPILE_DEFINITIONS_", cmSystemTools::UpperCase(config));
|
||||
cmProp prop = parent->GetProperty(defPropName);
|
||||
this->SetProperty(defPropName, cmToCStr(prop));
|
||||
this->SetProperty(defPropName, prop);
|
||||
}
|
||||
}
|
||||
|
||||
// labels
|
||||
this->SetProperty("LABELS", cmToCStr(parent->GetProperty("LABELS")));
|
||||
this->SetProperty("LABELS", parent->GetProperty("LABELS"));
|
||||
|
||||
// link libraries
|
||||
this->SetProperty("LINK_LIBRARIES",
|
||||
cmToCStr(parent->GetProperty("LINK_LIBRARIES")));
|
||||
this->SetProperty("LINK_LIBRARIES", parent->GetProperty("LINK_LIBRARIES"));
|
||||
|
||||
// the initial project name
|
||||
this->StateSnapshot.SetProjectName(parent->StateSnapshot.GetProjectName());
|
||||
@ -2308,7 +2307,7 @@ void cmMakefile::ExpandVariablesCMP0019()
|
||||
<< " " << dirs << "\n";
|
||||
/* clang-format on */
|
||||
}
|
||||
this->SetProperty("INCLUDE_DIRECTORIES", dirs.c_str());
|
||||
this->SetProperty("INCLUDE_DIRECTORIES", dirs);
|
||||
}
|
||||
|
||||
// Also for each target's INCLUDE_DIRECTORIES property:
|
||||
|
@ -6,7 +6,6 @@
|
||||
#include "cmExecutionStatus.h"
|
||||
#include "cmMakefile.h"
|
||||
#include "cmPolicies.h"
|
||||
#include "cmProperty.h"
|
||||
#include "cmRange.h"
|
||||
#include "cmSourceFile.h"
|
||||
#include "cmStringAlgorithms.h"
|
||||
@ -41,7 +40,7 @@ bool cmQTWrapCPPCommand(std::vector<std::string> const& args,
|
||||
cmStrCat(mf.GetCurrentBinaryDirectory(), "/moc_", srcName, ".cxx");
|
||||
cmSourceFile* sf = mf.GetOrCreateSource(newName, true);
|
||||
if (curr) {
|
||||
sf->SetProperty("ABSTRACT", cmToCStr(curr->GetProperty("ABSTRACT")));
|
||||
sf->SetProperty("ABSTRACT", curr->GetProperty("ABSTRACT"));
|
||||
}
|
||||
|
||||
// Compute the name of the header from which to generate the file.
|
||||
|
@ -186,7 +186,7 @@ void cmQtAutoGenGlobalInitializer::GetOrCreateGlobalTarget(
|
||||
cmProp folder =
|
||||
makefile->GetState()->GetGlobalProperty("AUTOGEN_TARGETS_FOLDER");
|
||||
if (folder) {
|
||||
target->SetProperty("FOLDER", *folder);
|
||||
target->SetProperty("FOLDER", folder);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ bool cmSetDirectoryPropertiesCommand(std::vector<std::string> const& args,
|
||||
"Commands and macros cannot be set using SET_CMAKE_PROPERTIES");
|
||||
return false;
|
||||
}
|
||||
status.GetMakefile().SetProperty(prop, (iter + 1)->c_str());
|
||||
status.GetMakefile().SetProperty(prop, *(iter + 1));
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -294,7 +294,7 @@ bool HandleAndValidateSourceFilePropertyGENERATED(
|
||||
sf->SetProperty("GENERATED", nullptr);
|
||||
break;
|
||||
case PropertyOp::Set:
|
||||
sf->SetProperty("GENERATED", propertyValue.c_str());
|
||||
sf->SetProperty("GENERATED", propertyValue);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
@ -474,7 +474,7 @@ bool HandleGlobalMode(cmExecutionStatus& status,
|
||||
if (remove) {
|
||||
cm->SetProperty(propertyName, nullptr);
|
||||
} else {
|
||||
cm->SetProperty(propertyName, propertyValue.c_str());
|
||||
cm->SetProperty(propertyName, propertyValue);
|
||||
}
|
||||
}
|
||||
|
||||
@ -520,7 +520,7 @@ bool HandleDirectoryMode(cmExecutionStatus& status,
|
||||
if (remove) {
|
||||
mf->SetProperty(propertyName, nullptr);
|
||||
} else {
|
||||
mf->SetProperty(propertyName, propertyValue.c_str());
|
||||
mf->SetProperty(propertyName, propertyValue);
|
||||
}
|
||||
}
|
||||
|
||||
@ -631,7 +631,7 @@ bool HandleSource(cmSourceFile* sf, const std::string& propertyName,
|
||||
if (remove) {
|
||||
sf->SetProperty(propertyName, nullptr);
|
||||
} else {
|
||||
sf->SetProperty(propertyName, propertyValue.c_str());
|
||||
sf->SetProperty(propertyName, propertyValue);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
@ -681,7 +681,7 @@ bool HandleTest(cmTest* test, const std::string& propertyName,
|
||||
if (remove) {
|
||||
test->SetProperty(propertyName, nullptr);
|
||||
} else {
|
||||
test->SetProperty(propertyName, propertyValue.c_str());
|
||||
test->SetProperty(propertyName, propertyValue);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -173,7 +173,7 @@ static bool RunCommandForScope(
|
||||
SetPropertyCommand::HandleAndValidateSourceFilePropertyGENERATED(
|
||||
sf, *(k + 1));
|
||||
} else {
|
||||
sf->SetProperty(*k, (k + 1)->c_str());
|
||||
sf->SetProperty(*k, *(k + 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ bool cmSetTestsPropertiesCommand(std::vector<std::string> const& args,
|
||||
// loop through all the props and set them
|
||||
for (auto k = propsIter + 1; k != args.end(); k += 2) {
|
||||
if (!k->empty()) {
|
||||
test->SetProperty(*k, (k + 1)->c_str());
|
||||
test->SetProperty(*k, *(k + 1));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -395,7 +395,7 @@ void cmStateSnapshot::InitializeFromParent()
|
||||
parent->BuildSystemDirectory->Properties.GetPropertyValue(
|
||||
"INCLUDE_REGULAR_EXPRESSION");
|
||||
this->Position->BuildSystemDirectory->Properties.SetProperty(
|
||||
"INCLUDE_REGULAR_EXPRESSION", cmToCStr(include_regex));
|
||||
"INCLUDE_REGULAR_EXPRESSION", include_regex);
|
||||
}
|
||||
|
||||
cmState* cmStateSnapshot::GetState() const
|
||||
|
@ -267,7 +267,7 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type,
|
||||
// Replace everything after "CMAKE_"
|
||||
defKey.replace(defKey.begin() + 6, defKey.end(), property);
|
||||
if (cmProp value = mf->GetDefinition(defKey)) {
|
||||
this->SetProperty(property, *value);
|
||||
this->SetProperty(property, value);
|
||||
}
|
||||
};
|
||||
auto initPropValue = [this, mf, &defKey](const std::string& property,
|
||||
@ -275,7 +275,7 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type,
|
||||
// Replace everything after "CMAKE_"
|
||||
defKey.replace(defKey.begin() + 6, defKey.end(), property);
|
||||
if (cmProp value = mf->GetDefinition(defKey)) {
|
||||
this->SetProperty(property, *value);
|
||||
this->SetProperty(property, value);
|
||||
} else if (default_value) {
|
||||
this->SetProperty(property, default_value);
|
||||
}
|
||||
@ -1388,14 +1388,14 @@ void cmTarget::StoreProperty(const std::string& prop, ValueType value)
|
||||
reusedFrom = ConvertToString(value);
|
||||
}
|
||||
|
||||
this->impl->Properties.SetProperty(prop, reusedFrom.c_str());
|
||||
this->impl->Properties.SetProperty(prop, reusedFrom);
|
||||
|
||||
reusedTarget->SetProperty("COMPILE_PDB_NAME", reusedFrom);
|
||||
reusedTarget->SetProperty("COMPILE_PDB_OUTPUT_DIRECTORY",
|
||||
cmStrCat(reusedFrom, ".dir/"));
|
||||
|
||||
cmProp tmp = reusedTarget->GetProperty("COMPILE_PDB_NAME");
|
||||
this->SetProperty("COMPILE_PDB_NAME", cmToCStr(tmp));
|
||||
this->SetProperty("COMPILE_PDB_NAME", tmp);
|
||||
this->AddUtility(reusedFrom, false, this->impl->Makefile);
|
||||
} else if (prop == propC_STANDARD || prop == propCXX_STANDARD ||
|
||||
prop == propCUDA_STANDARD || prop == propHIP_STANDARD ||
|
||||
|
Loading…
Reference in New Issue
Block a user