cmTarget: factor out linkable normal library target properties

This commit is contained in:
Ben Boeckel
2023-02-01 11:49:12 -05:00
parent 9f7a25a2c7
commit f0ae00d727
+10 -17
View File
@@ -300,6 +300,9 @@ struct TargetProperty
// Needs to be a "normal" target with an artifact that is not an // Needs to be a "normal" target with an artifact that is not an
// executable. // executable.
NonExecutableWithArtifact, NonExecutableWithArtifact,
// Needs to be a linkable library target (no `OBJECT` or `MODULE`
// libraries).
LinkableLibraryTarget,
}; };
enum class Repetition enum class Repetition
@@ -462,6 +465,8 @@ TargetProperty const StaticTargetProperties[] = {
{ "ANDROID_SECURE_PROPS_PATH"_s, IC::CanCompileSources }, { "ANDROID_SECURE_PROPS_PATH"_s, IC::CanCompileSources },
// ---- iOS // ---- iOS
{ "IOS_INSTALL_COMBINED"_s, IC::CanCompileSources }, { "IOS_INSTALL_COMBINED"_s, IC::CanCompileSources },
// ---- macOS
{ "FRAMEWORK_MULTI_CONFIG_POSTFIX_"_s, IC::LinkableLibraryTarget, R::PerConfig },
// ---- Windows // ---- Windows
{ "GNUtoMS"_s, IC::CanCompileSources }, { "GNUtoMS"_s, IC::CanCompileSources },
{ "WIN32_EXECUTABLE"_s, IC::CanCompileSources }, { "WIN32_EXECUTABLE"_s, IC::CanCompileSources },
@@ -934,23 +939,6 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type,
} }
}; };
// Setup per-configuration property default values.
if (this->GetType() != cmStateEnums::UTILITY &&
this->GetType() != cmStateEnums::GLOBAL_TARGET) {
// Collect the set of configuration types.
std::vector<std::string> configNames =
mf->GetGeneratorConfigs(cmMakefile::ExcludeEmptyConfig);
for (std::string const& configName : configNames) {
std::string configUpper = cmSystemTools::UpperCase(configName);
if (this->impl->TargetType == cmStateEnums::SHARED_LIBRARY ||
this->impl->TargetType == cmStateEnums::STATIC_LIBRARY) {
std::string property = cmStrCat("FRAMEWORK_MULTI_CONFIG_POSTFIX_",
cmSystemTools::UpperCase(configName));
initProp(property);
}
}
}
// Save the backtrace of target construction. // Save the backtrace of target construction.
this->impl->Backtrace = this->impl->Makefile->GetBacktrace(); this->impl->Backtrace = this->impl->Makefile->GetBacktrace();
@@ -1036,6 +1024,11 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type,
TargetProperty::InitCondition::NonExecutableWithArtifact); TargetProperty::InitCondition::NonExecutableWithArtifact);
} }
} }
if (this->impl->TargetType == cmStateEnums::SHARED_LIBRARY ||
this->impl->TargetType == cmStateEnums::STATIC_LIBRARY) {
metConditions.insert(
TargetProperty::InitCondition::LinkableLibraryTarget);
}
} }
std::vector<std::string> configNames = std::vector<std::string> configNames =