From 8004fe3f14aeafdc5ab6b9b8b6e23932d0252b32 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Wed, 1 Feb 2023 11:38:19 -0500 Subject: cmTarget: factor out Xcode-requiring properties --- Source/cmTarget.cxx | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 9cfdee3..57b5850 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -284,6 +284,8 @@ struct TargetProperty Never, // Only initialize if the target can compile sources. CanCompileSources, + // Only apply to Xcode generators. + NeedsXcode, }; enum class Repetition @@ -521,6 +523,9 @@ TargetProperty const StaticTargetProperties[] = { // Metadata { "EXPORT_COMPILE_COMMANDS"_s, IC::CanCompileSources }, { "FOLDER"_s }, + + // Xcode properties + { "XCODE_GENERATE_SCHEME"_s, IC::NeedsXcode }, /* clang-format on */ }; @@ -909,10 +914,6 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type, #endif } - if (this->GetGlobalGenerator()->IsXcode()) { - initProp("XCODE_GENERATE_SCHEME"); - } - // Setup per-configuration property default values. if (this->GetType() != cmStateEnums::UTILITY && this->GetType() != cmStateEnums::GLOBAL_TARGET) { @@ -1028,6 +1029,9 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type, if (this->CanCompileSources()) { metConditions.insert(TargetProperty::InitCondition::CanCompileSources); } + if (this->GetGlobalGenerator()->IsXcode()) { + metConditions.insert(TargetProperty::InitCondition::NeedsXcode); + } std::vector configNames = mf->GetGeneratorConfigs(cmMakefile::ExcludeEmptyConfig); -- cgit v0.12