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.
e << " \"" << depender->GetName() << "\" of type "
<< cmTarget::GetTargetTypeName(
depender->GetType()) << "\n";
<< cmState::GetTargetTypeName(depender->GetType()) << "\n";
// List its dependencies that are inside the component.
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,
"Only libraries may be used as try_compile or try_run IMPORTED "
"LINK_LIBRARIES. Got " + std::string(tgt->GetName()) + " of "
"type " + tgt->GetTargetTypeName(tgt->GetType()) + ".");
"type " + cmState::GetTargetTypeName(tgt->GetType()) + ".");
return -1;
}
if (tgt->IsImported())

View File

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

View File

@ -760,7 +760,7 @@ cmLocalGenerator::ExpandRuleVariable(std::string const& variable,
}
if(variable == "TARGET_TYPE")
{
return cmTarget::GetTargetTypeName(replaceValues.CMTarget->GetType());
return cmState::GetTargetTypeName(replaceValues.CMTarget->GetType());
}
}
if(replaceValues.Output)
@ -2134,7 +2134,7 @@ void cmLocalGenerator
w <<
cmPolicies::GetPolicyWarning(cmPolicies::CMP0063) << "\n"
"Target \"" << target->GetName() << "\" of "
"type \"" << cmTarget::GetTargetTypeName(target->GetType()) << "\" "
"type \"" << cmState::GetTargetTypeName(target->GetType()) << "\" "
"has the following visibility properties set for " << lang << ":\n" <<
warnCMP0063 <<
"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;
e << "Target \"" << lib << "\" of type "
<< cmTarget::GetTargetTypeName(tgt->GetType())
<< cmState::GetTargetTypeName(tgt->GetType())
<< " may not be linked into another target. "
<< "One may link only to STATIC or SHARED libraries, or "
<< "to executables with the ENABLE_EXPORTS property set.";

View File

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

View File

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

View File

@ -101,6 +101,33 @@ cmState::~cmState()
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[] =
{ "BOOL",
"PATH",

View File

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

View File

@ -33,33 +33,6 @@
#define UNORDERED_SET std::set
#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
{
@ -1892,7 +1865,7 @@ const char *cmTarget::GetProperty(const std::string& prop,
// the type property returns what type the target is
else if (prop == propTYPE)
{
return cmTarget::GetTargetTypeName(this->GetType());
return cmState::GetTargetTypeName(this->GetType());
}
else if(prop == propINCLUDE_DIRECTORIES)
{

View File

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