From c3dbbcef65b4b53f0679a2ad2253a6ebe9770257 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Wed, 1 Feb 2023 11:45:27 -0500 Subject: cmTarget: factor out normal non-imported target properties --- Source/cmTarget.cxx | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index e74d8e8..73344ad 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -292,6 +292,9 @@ struct TargetProperty NormalTarget, // Any non-imported target. NonImportedTarget, + // Needs to be a "normal" target (any non-global, non-utility target) that + // is not `IMPORTED`. + NormalNonImportedTarget, }; enum class Repetition @@ -421,6 +424,7 @@ TargetProperty const StaticTargetProperties[] = { { "AUTORCC_OPTIONS"_s, IC::CanCompileSources }, // Linking properties + { "LINK_LIBRARIES_ONLY_TARGETS"_s, IC::NormalNonImportedTarget }, { "LINK_SEARCH_START_STATIC"_s, IC::CanCompileSources }, { "LINK_SEARCH_END_STATIC"_s, IC::CanCompileSources }, // -- Dependent library lookup @@ -964,9 +968,6 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type, initProp(property); } } - if (!this->IsImported()) { - initProp("LINK_LIBRARIES_ONLY_TARGETS"); - } } // Save the backtrace of target construction. @@ -1043,6 +1044,10 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type, if (this->impl->TargetType != cmStateEnums::UTILITY && this->impl->TargetType != cmStateEnums::GLOBAL_TARGET) { metConditions.insert(TargetProperty::InitCondition::NormalTarget); + if (!this->IsImported()) { + metConditions.insert( + TargetProperty::InitCondition::NormalNonImportedTarget); + } } std::vector configNames = -- cgit v0.12