summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Boeckel <ben.boeckel@kitware.com>2023-02-01 16:52:43 (GMT)
committerBen Boeckel <ben.boeckel@kitware.com>2023-02-02 17:43:13 (GMT)
commit42575a660f3d9bd331d55b358ea781de4044aedc (patch)
treeccffbf3f066d676d60dccc3aaa26cd1aa8465156
parentf551f49a179e61d63b6a174ac35840525ed6dccd (diff)
downloadCMake-42575a660f3d9bd331d55b358ea781de4044aedc.zip
CMake-42575a660f3d9bd331d55b358ea781de4044aedc.tar.gz
CMake-42575a660f3d9bd331d55b358ea781de4044aedc.tar.bz2
cmTarget: factor out properties with targets with commands
-rw-r--r--Source/cmTarget.cxx13
1 files 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<TargetProperty::InitCondition> 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<std::string> configNames =
mf->GetGeneratorConfigs(cmMakefile::ExcludeEmptyConfig);