summaryrefslogtreecommitdiffstats
path: root/Source/cmTarget.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cmTarget.cxx')
-rw-r--r--Source/cmTarget.cxx59
1 files changed, 46 insertions, 13 deletions
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index e8d66cc..8c71295 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -629,10 +629,9 @@ public:
bool IsDLLPlatform;
bool IsAIX;
bool IsAndroid;
- bool IsImportedTarget;
- bool ImportedGloballyVisible;
bool BuildInterfaceIncludesAppended;
bool PerConfig;
+ cmTarget::Visibility TargetVisibility;
std::set<BT<std::pair<std::string, bool>>> Utilities;
std::vector<cmCustomCommand> PreBuildCommands;
std::vector<cmCustomCommand> PreLinkCommands;
@@ -667,6 +666,8 @@ public:
cmTargetInternals();
+ bool IsImported() const;
+
bool CheckImportedLibName(std::string const& prop,
std::string const& value) const;
@@ -914,9 +915,7 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type,
this->impl->IsDLLPlatform = false;
this->impl->IsAIX = false;
this->impl->IsAndroid = false;
- this->impl->IsImportedTarget =
- (vis == VisibilityImported || vis == VisibilityImportedGlobally);
- this->impl->ImportedGloballyVisible = vis == VisibilityImportedGlobally;
+ this->impl->TargetVisibility = vis;
this->impl->BuildInterfaceIncludesAppended = false;
this->impl->PerConfig = (perConfig == PerConfig::Yes);
@@ -939,7 +938,7 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type,
// Save the backtrace of target construction.
this->impl->Backtrace = this->impl->Makefile->GetBacktrace();
- if (!this->IsImported()) {
+ if (this->IsNormal()) {
// Initialize the INCLUDE_DIRECTORIES property based on the current value
// of the same directory property:
this->impl->IncludeDirectories.CopyFromDirectory(
@@ -988,7 +987,7 @@ 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()) {
+ if (this->IsNormal()) {
metConditions.insert(
TargetProperty::InitCondition::NormalNonImportedTarget);
}
@@ -1091,7 +1090,7 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type,
}
}
- if (this->IsImported() || mf->GetPropertyAsBool("SYSTEM")) {
+ if (!this->IsNormal() || mf->GetPropertyAsBool("SYSTEM")) {
this->SetProperty("SYSTEM", "ON");
}
@@ -1863,8 +1862,8 @@ void cmTarget::StoreProperty(const std::string& prop, ValueType value)
return;
}
/* no need to change anything if value does not change */
- if (!this->impl->ImportedGloballyVisible) {
- this->impl->ImportedGloballyVisible = true;
+ if (!this->IsImportedGloballyVisible()) {
+ this->impl->TargetVisibility = VisibilityImportedGlobally;
this->GetGlobalGenerator()->IndexTarget(this);
}
} else if (cmHasLiteralPrefix(prop, "IMPORTED_LIBNAME") &&
@@ -2555,14 +2554,48 @@ bool cmTarget::IsAIX() const
return this->impl->IsAIX;
}
+bool cmTarget::IsNormal() const
+{
+ switch (this->impl->TargetVisibility) {
+ case VisibilityNormal:
+ return true;
+ case VisibilityImported:
+ case VisibilityImportedGlobally:
+ return false;
+ }
+ assert(false && "unknown visibility (IsNormal)");
+ return false;
+}
+
+bool cmTargetInternals::IsImported() const
+{
+ switch (this->TargetVisibility) {
+ case cmTarget::VisibilityImported:
+ case cmTarget::VisibilityImportedGlobally:
+ return true;
+ case cmTarget::VisibilityNormal:
+ return false;
+ }
+ assert(false && "unknown visibility (IsImported)");
+ return false;
+}
+
bool cmTarget::IsImported() const
{
- return this->impl->IsImportedTarget;
+ return this->impl->IsImported();
}
bool cmTarget::IsImportedGloballyVisible() const
{
- return this->impl->ImportedGloballyVisible;
+ switch (this->impl->TargetVisibility) {
+ case VisibilityImportedGlobally:
+ return true;
+ case VisibilityNormal:
+ case VisibilityImported:
+ return false;
+ }
+ assert(false && "unknown visibility (IsImportedGloballyVisible)");
+ return false;
}
bool cmTarget::IsPerConfig() const
@@ -2858,7 +2891,7 @@ bool cmTargetInternals::CheckImportedLibName(std::string const& prop,
std::string const& value) const
{
if (this->TargetType != cmStateEnums::INTERFACE_LIBRARY ||
- !this->IsImportedTarget) {
+ !this->IsImported()) {
this->Makefile->IssueMessage(
MessageType::FATAL_ERROR,
prop +