mirror of
https://github.com/Kitware/CMake.git
synced 2026-05-03 21:00:01 -05:00
cmTarget: make Visibility an enum class
This commit is contained in:
@@ -85,7 +85,7 @@ std::string cmExportTryCompileFileGenerator::FindTargets(
|
|||||||
std::unique_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(*prop);
|
std::unique_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(*prop);
|
||||||
|
|
||||||
cmTarget dummyHead("try_compile_dummy_exe", cmStateEnums::EXECUTABLE,
|
cmTarget dummyHead("try_compile_dummy_exe", cmStateEnums::EXECUTABLE,
|
||||||
cmTarget::VisibilityNormal, tgt->Target->GetMakefile(),
|
cmTarget::Visibility::Normal, tgt->Target->GetMakefile(),
|
||||||
cmTarget::PerConfig::Yes);
|
cmTarget::PerConfig::Yes);
|
||||||
|
|
||||||
cmGeneratorTarget gDummyHead(&dummyHead, tgt->GetLocalGenerator());
|
cmGeneratorTarget gDummyHead(&dummyHead, tgt->GetLocalGenerator());
|
||||||
|
|||||||
@@ -2120,7 +2120,7 @@ std::pair<cmTarget&, bool> cmMakefile::CreateNewTarget(
|
|||||||
cmTarget::PerConfig perConfig)
|
cmTarget::PerConfig perConfig)
|
||||||
{
|
{
|
||||||
auto ib = this->Targets.emplace(
|
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;
|
auto it = ib.first;
|
||||||
if (!ib.second) {
|
if (!ib.second) {
|
||||||
return std::make_pair(std::ref(it->second), false);
|
return std::make_pair(std::ref(it->second), false);
|
||||||
@@ -4203,8 +4203,8 @@ cmTarget* cmMakefile::AddImportedTarget(const std::string& name,
|
|||||||
// Create the target.
|
// Create the target.
|
||||||
std::unique_ptr<cmTarget> target(
|
std::unique_ptr<cmTarget> target(
|
||||||
new cmTarget(name, type,
|
new cmTarget(name, type,
|
||||||
global ? cmTarget::VisibilityImportedGlobally
|
global ? cmTarget::Visibility::ImportedGlobally
|
||||||
: cmTarget::VisibilityImported,
|
: cmTarget::Visibility::Imported,
|
||||||
this, cmTarget::PerConfig::Yes));
|
this, cmTarget::PerConfig::Yes));
|
||||||
|
|
||||||
// Add to the set of available imported targets.
|
// Add to the set of available imported targets.
|
||||||
|
|||||||
+10
-10
@@ -1863,7 +1863,7 @@ void cmTarget::StoreProperty(const std::string& prop, ValueType value)
|
|||||||
}
|
}
|
||||||
/* no need to change anything if value does not change */
|
/* no need to change anything if value does not change */
|
||||||
if (!this->IsImportedGloballyVisible()) {
|
if (!this->IsImportedGloballyVisible()) {
|
||||||
this->impl->TargetVisibility = VisibilityImportedGlobally;
|
this->impl->TargetVisibility = Visibility::ImportedGlobally;
|
||||||
this->GetGlobalGenerator()->IndexTarget(this);
|
this->GetGlobalGenerator()->IndexTarget(this);
|
||||||
}
|
}
|
||||||
} else if (cmHasLiteralPrefix(prop, "IMPORTED_LIBNAME") &&
|
} else if (cmHasLiteralPrefix(prop, "IMPORTED_LIBNAME") &&
|
||||||
@@ -2557,10 +2557,10 @@ bool cmTarget::IsAIX() const
|
|||||||
bool cmTarget::IsNormal() const
|
bool cmTarget::IsNormal() const
|
||||||
{
|
{
|
||||||
switch (this->impl->TargetVisibility) {
|
switch (this->impl->TargetVisibility) {
|
||||||
case VisibilityNormal:
|
case Visibility::Normal:
|
||||||
return true;
|
return true;
|
||||||
case VisibilityImported:
|
case Visibility::Imported:
|
||||||
case VisibilityImportedGlobally:
|
case Visibility::ImportedGlobally:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
assert(false && "unknown visibility (IsNormal)");
|
assert(false && "unknown visibility (IsNormal)");
|
||||||
@@ -2570,10 +2570,10 @@ bool cmTarget::IsNormal() const
|
|||||||
bool cmTargetInternals::IsImported() const
|
bool cmTargetInternals::IsImported() const
|
||||||
{
|
{
|
||||||
switch (this->TargetVisibility) {
|
switch (this->TargetVisibility) {
|
||||||
case cmTarget::VisibilityImported:
|
case cmTarget::Visibility::Imported:
|
||||||
case cmTarget::VisibilityImportedGlobally:
|
case cmTarget::Visibility::ImportedGlobally:
|
||||||
return true;
|
return true;
|
||||||
case cmTarget::VisibilityNormal:
|
case cmTarget::Visibility::Normal:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
assert(false && "unknown visibility (IsImported)");
|
assert(false && "unknown visibility (IsImported)");
|
||||||
@@ -2588,10 +2588,10 @@ bool cmTarget::IsImported() const
|
|||||||
bool cmTarget::IsImportedGloballyVisible() const
|
bool cmTarget::IsImportedGloballyVisible() const
|
||||||
{
|
{
|
||||||
switch (this->impl->TargetVisibility) {
|
switch (this->impl->TargetVisibility) {
|
||||||
case VisibilityImportedGlobally:
|
case Visibility::ImportedGlobally:
|
||||||
return true;
|
return true;
|
||||||
case VisibilityNormal:
|
case Visibility::Normal:
|
||||||
case VisibilityImported:
|
case Visibility::Imported:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
assert(false && "unknown visibility (IsImportedGloballyVisible)");
|
assert(false && "unknown visibility (IsImportedGloballyVisible)");
|
||||||
|
|||||||
+4
-4
@@ -46,11 +46,11 @@ class BTs;
|
|||||||
class cmTarget
|
class cmTarget
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
enum Visibility
|
enum class Visibility
|
||||||
{
|
{
|
||||||
VisibilityNormal,
|
Normal,
|
||||||
VisibilityImported,
|
Imported,
|
||||||
VisibilityImportedGlobally
|
ImportedGlobally,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class PerConfig
|
enum class PerConfig
|
||||||
|
|||||||
Reference in New Issue
Block a user