cmState: Move GetTargetTypeName from cmTarget.

This commit is contained in:
Stephen Kelly 2015-10-08 00:26:50 +02:00
parent 38df5c36d6
commit 55474e6182
11 changed files with 41 additions and 43 deletions

View File

@ -554,8 +554,7 @@ cmComputeTargetDepends
// Describe the depender. // Describe the depender.
e << " \"" << depender->GetName() << "\" of type " e << " \"" << depender->GetName() << "\" of type "
<< cmTarget::GetTargetTypeName( << cmState::GetTargetTypeName(depender->GetType()) << "\n";
depender->GetType()) << "\n";
// List its dependencies that are inside the component. // List its dependencies that are inside the component.
EdgeList const& nl = this->InitialGraph[i]; EdgeList const& nl = this->InitialGraph[i];

View File

@ -107,7 +107,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
this->Makefile->IssueMessage(cmake::FATAL_ERROR, this->Makefile->IssueMessage(cmake::FATAL_ERROR,
"Only libraries may be used as try_compile or try_run IMPORTED " "Only libraries may be used as try_compile or try_run IMPORTED "
"LINK_LIBRARIES. Got " + std::string(tgt->GetName()) + " of " "LINK_LIBRARIES. Got " + std::string(tgt->GetName()) + " of "
"type " + tgt->GetTargetTypeName(tgt->GetType()) + "."); "type " + cmState::GetTargetTypeName(tgt->GetType()) + ".");
return -1; return -1;
} }
if (tgt->IsImported()) if (tgt->IsImported())

View File

@ -1965,7 +1965,7 @@ cmGeneratorTarget::CompileInfo const* cmGeneratorTarget::GetCompileInfo(
std::string msg = "cmTarget::GetCompileInfo called for "; std::string msg = "cmTarget::GetCompileInfo called for ";
msg += this->GetName(); msg += this->GetName();
msg += " which has type "; msg += " which has type ";
msg += cmTarget::GetTargetTypeName(this->GetType()); msg += cmState::GetTargetTypeName(this->GetType());
this->LocalGenerator->IssueMessage(cmake::INTERNAL_ERROR, msg); this->LocalGenerator->IssueMessage(cmake::INTERNAL_ERROR, msg);
return 0; return 0;
} }
@ -4697,7 +4697,7 @@ cmGeneratorTarget::OutputInfo const* cmGeneratorTarget::GetOutputInfo(
std::string msg = "cmGeneratorTarget::GetOutputInfo called for "; std::string msg = "cmGeneratorTarget::GetOutputInfo called for ";
msg += this->GetName(); msg += this->GetName();
msg += " which has type "; msg += " which has type ";
msg += cmTarget::GetTargetTypeName(this->GetType()); msg += cmState::GetTargetTypeName(this->GetType());
this->LocalGenerator->IssueMessage(cmake::INTERNAL_ERROR, msg); this->LocalGenerator->IssueMessage(cmake::INTERNAL_ERROR, msg);
return 0; return 0;
} }

View File

@ -760,7 +760,7 @@ cmLocalGenerator::ExpandRuleVariable(std::string const& variable,
} }
if(variable == "TARGET_TYPE") if(variable == "TARGET_TYPE")
{ {
return cmTarget::GetTargetTypeName(replaceValues.CMTarget->GetType()); return cmState::GetTargetTypeName(replaceValues.CMTarget->GetType());
} }
} }
if(replaceValues.Output) if(replaceValues.Output)
@ -2134,7 +2134,7 @@ void cmLocalGenerator
w << w <<
cmPolicies::GetPolicyWarning(cmPolicies::CMP0063) << "\n" cmPolicies::GetPolicyWarning(cmPolicies::CMP0063) << "\n"
"Target \"" << target->GetName() << "\" of " "Target \"" << target->GetName() << "\" of "
"type \"" << cmTarget::GetTargetTypeName(target->GetType()) << "\" " "type \"" << cmState::GetTargetTypeName(target->GetType()) << "\" "
"has the following visibility properties set for " << lang << ":\n" << "has the following visibility properties set for " << lang << ":\n" <<
warnCMP0063 << warnCMP0063 <<
"For compatibility CMake is not honoring them for this target."; "For compatibility CMake is not honoring them for this target.";

View File

@ -1426,7 +1426,7 @@ void cmMakefile::AddLinkLibraryForTarget(const std::string& target,
{ {
std::ostringstream e; std::ostringstream e;
e << "Target \"" << lib << "\" of type " e << "Target \"" << lib << "\" of type "
<< cmTarget::GetTargetTypeName(tgt->GetType()) << cmState::GetTargetTypeName(tgt->GetType())
<< " may not be linked into another target. " << " may not be linked into another target. "
<< "One may link only to STATIC or SHARED libraries, or " << "One may link only to STATIC or SHARED libraries, or "
<< "to executables with the ENABLE_EXPORTS property set."; << "to executables with the ENABLE_EXPORTS property set.";

View File

@ -103,7 +103,7 @@ void cmNinjaNormalTargetGenerator::WriteLanguagesRules()
cmGlobalNinjaGenerator::WriteDivider(this->GetRulesFileStream()); cmGlobalNinjaGenerator::WriteDivider(this->GetRulesFileStream());
this->GetRulesFileStream() this->GetRulesFileStream()
<< "# Rules for each languages for " << "# Rules for each languages for "
<< cmTarget::GetTargetTypeName(this->GetGeneratorTarget()->GetType()) << cmState::GetTargetTypeName(this->GetGeneratorTarget()->GetType())
<< " target " << " target "
<< this->GetTargetName() << this->GetTargetName()
<< "\n\n"; << "\n\n";
@ -156,8 +156,7 @@ cmNinjaNormalTargetGenerator
{ {
return this->TargetLinkLanguage return this->TargetLinkLanguage
+ "_" + "_"
+ cmTarget::GetTargetTypeName( + cmState::GetTargetTypeName(this->GetGeneratorTarget()->GetType())
this->GetGeneratorTarget()->GetType())
+ "_LINKER__" + "_LINKER__"
+ cmGlobalNinjaGenerator::EncodeRuleName(this->GetTarget()->GetName()) + cmGlobalNinjaGenerator::EncodeRuleName(this->GetTarget()->GetName())
; ;
@ -446,7 +445,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
const cmState::TargetType targetType = target.GetType(); const cmState::TargetType targetType = target.GetType();
this->GetBuildFileStream() this->GetBuildFileStream()
<< "# Link build statements for " << "# Link build statements for "
<< cmTarget::GetTargetTypeName(targetType) << cmState::GetTargetTypeName(targetType)
<< " target " << " target "
<< this->GetTargetName() << this->GetTargetName()
<< "\n\n"; << "\n\n";

View File

@ -480,8 +480,7 @@ cmNinjaTargetGenerator
cmGlobalNinjaGenerator::WriteDivider(this->GetBuildFileStream()); cmGlobalNinjaGenerator::WriteDivider(this->GetBuildFileStream());
this->GetBuildFileStream() this->GetBuildFileStream()
<< "# Object build statements for " << "# Object build statements for "
<< cmTarget::GetTargetTypeName( << cmState::GetTargetTypeName(this->GetGeneratorTarget()->GetType())
this->GetGeneratorTarget()->GetType())
<< " target " << " target "
<< this->GetTargetName() << this->GetTargetName()
<< "\n\n"; << "\n\n";

View File

@ -101,6 +101,33 @@ cmState::~cmState()
cmDeleteAll(this->Commands); cmDeleteAll(this->Commands);
} }
const char* cmState::GetTargetTypeName(cmState::TargetType targetType)
{
switch( targetType )
{
case cmState::STATIC_LIBRARY:
return "STATIC_LIBRARY";
case cmState::MODULE_LIBRARY:
return "MODULE_LIBRARY";
case cmState::SHARED_LIBRARY:
return "SHARED_LIBRARY";
case cmState::OBJECT_LIBRARY:
return "OBJECT_LIBRARY";
case cmState::EXECUTABLE:
return "EXECUTABLE";
case cmState::UTILITY:
return "UTILITY";
case cmState::GLOBAL_TARGET:
return "GLOBAL_TARGET";
case cmState::INTERFACE_LIBRARY:
return "INTERFACE_LIBRARY";
case cmState::UNKNOWN_LIBRARY:
return "UNKNOWN_LIBRARY";
}
assert(0 && "Unexpected target type");
return 0;
}
const char* cmCacheEntryTypes[] = const char* cmCacheEntryTypes[] =
{ "BOOL", { "BOOL",
"PATH", "PATH",

View File

@ -187,6 +187,8 @@ public:
INTERFACE_LIBRARY, INTERFACE_LIBRARY,
UNKNOWN_LIBRARY}; UNKNOWN_LIBRARY};
static const char* GetTargetTypeName(cmState::TargetType targetType);
Snapshot CreateBaseSnapshot(); Snapshot CreateBaseSnapshot();
Snapshot Snapshot
CreateBuildsystemDirectorySnapshot(Snapshot originSnapshot, CreateBuildsystemDirectorySnapshot(Snapshot originSnapshot,

View File

@ -33,33 +33,6 @@
#define UNORDERED_SET std::set #define UNORDERED_SET std::set
#endif #endif
const char* cmTarget::GetTargetTypeName(cmState::TargetType targetType)
{
switch( targetType )
{
case cmState::STATIC_LIBRARY:
return "STATIC_LIBRARY";
case cmState::MODULE_LIBRARY:
return "MODULE_LIBRARY";
case cmState::SHARED_LIBRARY:
return "SHARED_LIBRARY";
case cmState::OBJECT_LIBRARY:
return "OBJECT_LIBRARY";
case cmState::EXECUTABLE:
return "EXECUTABLE";
case cmState::UTILITY:
return "UTILITY";
case cmState::GLOBAL_TARGET:
return "GLOBAL_TARGET";
case cmState::INTERFACE_LIBRARY:
return "INTERFACE_LIBRARY";
case cmState::UNKNOWN_LIBRARY:
return "UNKNOWN_LIBRARY";
}
assert(0 && "Unexpected target type");
return 0;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
class cmTargetInternals class cmTargetInternals
{ {
@ -1892,7 +1865,7 @@ const char *cmTarget::GetProperty(const std::string& prop,
// the type property returns what type the target is // the type property returns what type the target is
else if (prop == propTYPE) else if (prop == propTYPE)
{ {
return cmTarget::GetTargetTypeName(this->GetType()); return cmState::GetTargetTypeName(this->GetType());
} }
else if(prop == propINCLUDE_DIRECTORIES) else if(prop == propINCLUDE_DIRECTORIES)
{ {

View File

@ -77,7 +77,6 @@ class cmTarget
{ {
public: public:
cmTarget(); cmTarget();
static const char* GetTargetTypeName(cmState::TargetType targetType);
enum CustomCommandType { PRE_BUILD, PRE_LINK, POST_BUILD }; enum CustomCommandType { PRE_BUILD, PRE_LINK, POST_BUILD };
/** /**