summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Boeckel <ben.boeckel@kitware.com>2023-02-14 12:21:06 -0500
committerBen Boeckel <ben.boeckel@kitware.com>2023-02-14 12:28:58 -0500
commit1d0426f6426ef88342f3a57fb555a2b2d8891712 (patch)
tree995dd6d865e4ce1e2fa3b97396a19d47ed82b0f5
parent5b5869532145ff4425d7abfd09eaae6a638b6810 (diff)
downloadcmake-1d0426f6426ef88342f3a57fb555a2b2d8891712.tar.gz
cmTarget: make Visibility an `enum class`
-rw-r--r--Source/cmExportTryCompileFileGenerator.cxx2
-rw-r--r--Source/cmMakefile.cxx6
-rw-r--r--Source/cmTarget.cxx20
-rw-r--r--Source/cmTarget.h8
4 files changed, 18 insertions, 18 deletions
diff --git a/Source/cmExportTryCompileFileGenerator.cxx b/Source/cmExportTryCompileFileGenerator.cxx
index 33c057dab0..c6ebad5c2d 100644
--- a/Source/cmExportTryCompileFileGenerator.cxx
+++ b/Source/cmExportTryCompileFileGenerator.cxx
@@ -85,7 +85,7 @@ std::string cmExportTryCompileFileGenerator::FindTargets(
std::unique_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(*prop);
cmTarget dummyHead("try_compile_dummy_exe", cmStateEnums::EXECUTABLE,
- cmTarget::VisibilityNormal, tgt->Target->GetMakefile(),
+ cmTarget::Visibility::Normal, tgt->Target->GetMakefile(),
cmTarget::PerConfig::Yes);
cmGeneratorTarget gDummyHead(&dummyHead, tgt->GetLocalGenerator());
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 0ad0e6e6ff..457204a53b 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -2120,7 +2120,7 @@ std::pair<cmTarget&, bool> cmMakefile::CreateNewTarget(
cmTarget::PerConfig perConfig)
{
auto ib = this->Targets.emplace(
- name, cmTarget(name, type, cmTarget::VisibilityNormal, this, perConfig));
+ name, cmTarget(name, type, cmTarget::Visibility::Normal, this, perConfig));
auto it = ib.first;
if (!ib.second) {
return std::make_pair(std::ref(it->second), false);
@@ -4203,8 +4203,8 @@ cmTarget* cmMakefile::AddImportedTarget(const std::string& name,
// Create the target.
std::unique_ptr<cmTarget> target(
new cmTarget(name, type,
- global ? cmTarget::VisibilityImportedGlobally
- : cmTarget::VisibilityImported,
+ global ? cmTarget::Visibility::ImportedGlobally
+ : cmTarget::Visibility::Imported,
this, cmTarget::PerConfig::Yes));
// Add to the set of available imported targets.
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 8c7129598b..48f92b5537 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -1863,7 +1863,7 @@ void cmTarget::StoreProperty(const std::string& prop, ValueType value)
}
/* no need to change anything if value does not change */
if (!this->IsImportedGloballyVisible()) {
- this->impl->TargetVisibility = VisibilityImportedGlobally;
+ this->impl->TargetVisibility = Visibility::ImportedGlobally;
this->GetGlobalGenerator()->IndexTarget(this);
}
} else if (cmHasLiteralPrefix(prop, "IMPORTED_LIBNAME") &&
@@ -2557,10 +2557,10 @@ bool cmTarget::IsAIX() const
bool cmTarget::IsNormal() const
{
switch (this->impl->TargetVisibility) {
- case VisibilityNormal:
+ case Visibility::Normal:
return true;
- case VisibilityImported:
- case VisibilityImportedGlobally:
+ case Visibility::Imported:
+ case Visibility::ImportedGlobally:
return false;
}
assert(false && "unknown visibility (IsNormal)");
@@ -2570,10 +2570,10 @@ bool cmTarget::IsNormal() const
bool cmTargetInternals::IsImported() const
{
switch (this->TargetVisibility) {
- case cmTarget::VisibilityImported:
- case cmTarget::VisibilityImportedGlobally:
+ case cmTarget::Visibility::Imported:
+ case cmTarget::Visibility::ImportedGlobally:
return true;
- case cmTarget::VisibilityNormal:
+ case cmTarget::Visibility::Normal:
return false;
}
assert(false && "unknown visibility (IsImported)");
@@ -2588,10 +2588,10 @@ bool cmTarget::IsImported() const
bool cmTarget::IsImportedGloballyVisible() const
{
switch (this->impl->TargetVisibility) {
- case VisibilityImportedGlobally:
+ case Visibility::ImportedGlobally:
return true;
- case VisibilityNormal:
- case VisibilityImported:
+ case Visibility::Normal:
+ case Visibility::Imported:
return false;
}
assert(false && "unknown visibility (IsImportedGloballyVisible)");
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index 51bbd54422..b96bdf2672 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -46,11 +46,11 @@ class BTs;
class cmTarget
{
public:
- enum Visibility
+ enum class Visibility
{
- VisibilityNormal,
- VisibilityImported,
- VisibilityImportedGlobally
+ Normal,
+ Imported,
+ ImportedGlobally,
};
enum class PerConfig