mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-10 07:40:03 -06:00
cmPackageInfoReader: Just use std::string
Change cmPackageInfoReader::SetMetaProperty to just take the property name as a std::string. We end up constructing one when we call cmTarget::SetProperty, so we might as well do it up front and be done with it. (Before, we were converting a string_view to char*, which is decidedly non-optimal.)
This commit is contained in:
committed by
Brad King
parent
6c2fc502b6
commit
be99a82eee
@@ -646,13 +646,13 @@ void cmPackageInfoReader::SetImportProperty(cmTarget* target,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void cmPackageInfoReader::SetMetaProperty(
|
void cmPackageInfoReader::SetMetaProperty(
|
||||||
cmTarget* target, cm::string_view property, Json::Value const& value,
|
cmTarget* target, std::string const& property, Json::Value const& value,
|
||||||
std::string const& defaultValue) const
|
std::string const& defaultValue) const
|
||||||
{
|
{
|
||||||
if (!value.isNull()) {
|
if (!value.isNull()) {
|
||||||
target->SetProperty(property.data(), value.asString());
|
target->SetProperty(property, value.asString());
|
||||||
} else if (!defaultValue.empty()) {
|
} else if (!defaultValue.empty()) {
|
||||||
target->SetProperty(property.data(), defaultValue);
|
target->SetProperty(property, defaultValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -734,7 +734,7 @@ void cmPackageInfoReader::SetTargetProperties(
|
|||||||
|
|
||||||
// Add other information.
|
// Add other information.
|
||||||
if (configuration.empty()) {
|
if (configuration.empty()) {
|
||||||
this->SetMetaProperty(target, "SPDX_LICENSE"_s, data["license"],
|
this->SetMetaProperty(target, "SPDX_LICENSE", data["license"],
|
||||||
this->DefaultLicense);
|
this->DefaultLicense);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ private:
|
|||||||
void SetImportProperty(cmTarget* target, cm::string_view property,
|
void SetImportProperty(cmTarget* target, cm::string_view property,
|
||||||
cm::string_view configuration,
|
cm::string_view configuration,
|
||||||
Json::Value const& value) const;
|
Json::Value const& value) const;
|
||||||
void SetMetaProperty(cmTarget* target, cm::string_view property,
|
void SetMetaProperty(cmTarget* target, std::string const& property,
|
||||||
Json::Value const& value,
|
Json::Value const& value,
|
||||||
std::string const& defaultValue = {}) const;
|
std::string const& defaultValue = {}) const;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user