From 42575a660f3d9bd331d55b358ea781de4044aedc Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Wed, 1 Feb 2023 11:52:43 -0500 Subject: cmTarget: factor out properties with targets with commands --- Source/cmTarget.cxx | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 52c9508..09d0b80 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -308,6 +308,9 @@ struct TargetProperty // Needs to be a target with meaningful symbol exports (`SHARED` or // `EXECUTABLE`). TargetWithSymbolExports, + // Targets with "commands" associated with them. Basically everything + // except global and `INTERFACE` targets. + TargetWithCommands, }; enum class Repetition @@ -398,6 +401,8 @@ TargetProperty const StaticTargetProperties[] = { COMMON_LANGUAGE_PROPERTIES(CXX), // ---- CSharp { "DOTNET_SDK"_s, IC::NonImportedTarget }, + { "DOTNET_TARGET_FRAMEWORK"_s, IC::TargetWithCommands }, + { "DOTNET_TARGET_FRAMEWORK_VERSION"_s, IC::TargetWithCommands }, // ---- CUDA COMMON_LANGUAGE_PROPERTIES(CUDA), { "CUDA_SEPARABLE_COMPILATION"_s, IC::CanCompileSources }, @@ -991,11 +996,6 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type, this->impl->PolicyMap.Set(cmPolicies::CMP0022, cmPolicies::NEW); } - if (this->impl->TargetType <= cmStateEnums::GLOBAL_TARGET) { - initProp("DOTNET_TARGET_FRAMEWORK"); - initProp("DOTNET_TARGET_FRAMEWORK_VERSION"); - } - std::set metConditions; metConditions.insert(TargetProperty::InitCondition::Always); if (this->CanCompileSources()) { @@ -1039,6 +1039,9 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type, metConditions.insert( TargetProperty::InitCondition::TargetWithSymbolExports); } + if (this->impl->TargetType <= cmStateEnums::GLOBAL_TARGET) { + metConditions.insert(TargetProperty::InitCondition::TargetWithCommands); + } std::vector configNames = mf->GetGeneratorConfigs(cmMakefile::ExcludeEmptyConfig); -- cgit v0.12