cmGeneratorTarget: Move GetExecutableNames from cmTarget.
This commit is contained in:
parent
7da4c9d4ed
commit
47803e6f8e
|
@ -1248,8 +1248,7 @@ void cmGeneratorTarget::GenerateTargetManifest(
|
|||
std::string pdbName;
|
||||
if(this->GetType() == cmTarget::EXECUTABLE)
|
||||
{
|
||||
this->Target->GetExecutableNames(name, realName, impName, pdbName,
|
||||
config);
|
||||
this->GetExecutableNames(name, realName, impName, pdbName, config);
|
||||
}
|
||||
else if(this->GetType() == cmTarget::STATIC_LIBRARY ||
|
||||
this->GetType() == cmTarget::SHARED_LIBRARY ||
|
||||
|
@ -1368,7 +1367,7 @@ cmGeneratorTarget::NormalGetRealName(const std::string& config) const
|
|||
std::string realName;
|
||||
std::string impName;
|
||||
std::string pdbName;
|
||||
this->Target->GetExecutableNames(name, realName, impName, pdbName, config);
|
||||
this->GetExecutableNames(name, realName, impName, pdbName, config);
|
||||
return realName;
|
||||
}
|
||||
else
|
||||
|
@ -1385,6 +1384,69 @@ cmGeneratorTarget::NormalGetRealName(const std::string& config) const
|
|||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
void cmGeneratorTarget::GetExecutableNames(std::string& name,
|
||||
std::string& realName,
|
||||
std::string& impName,
|
||||
std::string& pdbName,
|
||||
const std::string& config) const
|
||||
{
|
||||
// This should not be called for imported targets.
|
||||
// TODO: Split cmTarget into a class hierarchy to get compile-time
|
||||
// enforcement of the limited imported target API.
|
||||
if(this->Target->IsImported())
|
||||
{
|
||||
std::string msg =
|
||||
"GetExecutableNames called on imported target: ";
|
||||
msg += this->GetName();
|
||||
this->LocalGenerator->IssueMessage(cmake::INTERNAL_ERROR, msg);
|
||||
}
|
||||
|
||||
// This versioning is supported only for executables and then only
|
||||
// when the platform supports symbolic links.
|
||||
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||
const char* version = 0;
|
||||
#else
|
||||
// Check for executable version properties.
|
||||
const char* version = this->GetProperty("VERSION");
|
||||
if(this->GetType() != cmTarget::EXECUTABLE || this->Makefile->IsOn("XCODE"))
|
||||
{
|
||||
version = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Get the components of the executable name.
|
||||
std::string prefix;
|
||||
std::string base;
|
||||
std::string suffix;
|
||||
this->Target->GetFullNameInternal(config, false, prefix, base, suffix);
|
||||
|
||||
// The executable name.
|
||||
name = prefix+base+suffix;
|
||||
|
||||
// The executable's real name on disk.
|
||||
#if defined(__CYGWIN__)
|
||||
realName = prefix+base;
|
||||
#else
|
||||
realName = name;
|
||||
#endif
|
||||
if(version)
|
||||
{
|
||||
realName += "-";
|
||||
realName += version;
|
||||
}
|
||||
#if defined(__CYGWIN__)
|
||||
realName += suffix;
|
||||
#endif
|
||||
|
||||
// The import library name.
|
||||
impName = this->Target->GetFullNameInternal(config, true);
|
||||
|
||||
// The program database file name.
|
||||
pdbName = this->Target->GetPDBName(config);
|
||||
}
|
||||
|
||||
|
||||
bool cmStrictTargetComparison::operator()(cmTarget const* t1,
|
||||
cmTarget const* t2) const
|
||||
{
|
||||
|
|
|
@ -184,6 +184,12 @@ public:
|
|||
void GetAutoUicOptions(std::vector<std::string> &result,
|
||||
const std::string& config) const;
|
||||
|
||||
/** Get the names of the executable needed to generate a build rule
|
||||
that takes into account executable version numbers. This should
|
||||
be called only on an executable target. */
|
||||
void GetExecutableNames(std::string& name, std::string& realName,
|
||||
std::string& impName, std::string& pdbName,
|
||||
const std::string& config) const;
|
||||
|
||||
struct SourceFileFlags
|
||||
GetTargetSourceFileFlags(const cmSourceFile* sf) const;
|
||||
|
|
|
@ -125,7 +125,7 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(std::ostream& os,
|
|||
std::string targetNameReal;
|
||||
std::string targetNameImport;
|
||||
std::string targetNamePDB;
|
||||
this->Target->Target->GetExecutableNames(targetName, targetNameReal,
|
||||
this->Target->GetExecutableNames(targetName, targetNameReal,
|
||||
targetNameImport, targetNamePDB,
|
||||
config);
|
||||
if(this->ImportLibrary)
|
||||
|
@ -372,13 +372,16 @@ cmInstallTargetGenerator::GetInstallFilename(cmTarget const* target,
|
|||
{
|
||||
std::string fname;
|
||||
// Compute the name of the library.
|
||||
cmGeneratorTarget *gtgt = target->GetMakefile()
|
||||
->GetGlobalGenerator()
|
||||
->GetGeneratorTarget(target);
|
||||
if(target->GetType() == cmTarget::EXECUTABLE)
|
||||
{
|
||||
std::string targetName;
|
||||
std::string targetNameReal;
|
||||
std::string targetNameImport;
|
||||
std::string targetNamePDB;
|
||||
target->GetExecutableNames(targetName, targetNameReal,
|
||||
gtgt->GetExecutableNames(targetName, targetNameReal,
|
||||
targetNameImport, targetNamePDB,
|
||||
config);
|
||||
if(nameType == NameImplib)
|
||||
|
|
|
@ -1244,7 +1244,7 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout,
|
|||
std::string targetNameFull;
|
||||
std::string targetNameImport;
|
||||
std::string targetNamePDB;
|
||||
target.GetExecutableNames(targetName, targetNameFull,
|
||||
gt->GetExecutableNames(targetName, targetNameFull,
|
||||
targetNameImport, targetNamePDB, configName);
|
||||
|
||||
// Compute the link library and directory information.
|
||||
|
|
|
@ -25,7 +25,7 @@ cmMakefileExecutableTargetGenerator
|
|||
cmMakefileTargetGenerator(target)
|
||||
{
|
||||
this->CustomCommandDriver = OnDepends;
|
||||
this->Target->GetExecutableNames(
|
||||
this->GeneratorTarget->GetExecutableNames(
|
||||
this->TargetNameOut, this->TargetNameReal, this->TargetNameImport,
|
||||
this->TargetNamePDB, this->ConfigName);
|
||||
|
||||
|
@ -94,7 +94,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
|
|||
std::string targetNameReal;
|
||||
std::string targetNameImport;
|
||||
std::string targetNamePDB;
|
||||
this->Target->GetExecutableNames
|
||||
this->GeneratorTarget->GetExecutableNames
|
||||
(targetName, targetNameReal, targetNameImport, targetNamePDB,
|
||||
this->ConfigName);
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ cmNinjaNormalTargetGenerator(cmGeneratorTarget* target)
|
|||
this->TargetLinkLanguage = target->Target
|
||||
->GetLinkerLanguage(this->GetConfigName());
|
||||
if (target->GetType() == cmTarget::EXECUTABLE)
|
||||
target->Target->GetExecutableNames(this->TargetNameOut,
|
||||
this->GetGeneratorTarget()->GetExecutableNames(this->TargetNameOut,
|
||||
this->TargetNameReal,
|
||||
this->TargetNameImport,
|
||||
this->TargetNamePDB,
|
||||
|
|
|
@ -3967,68 +3967,6 @@ void cmTarget::ComputeVersionedName(std::string& vName,
|
|||
vName += this->IsApple? suffix : std::string();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
void cmTarget::GetExecutableNames(std::string& name,
|
||||
std::string& realName,
|
||||
std::string& impName,
|
||||
std::string& pdbName,
|
||||
const std::string& config) const
|
||||
{
|
||||
// This should not be called for imported targets.
|
||||
// TODO: Split cmTarget into a class hierarchy to get compile-time
|
||||
// enforcement of the limited imported target API.
|
||||
if(this->IsImported())
|
||||
{
|
||||
std::string msg =
|
||||
"GetExecutableNames called on imported target: ";
|
||||
msg += this->GetName();
|
||||
this->GetMakefile()->IssueMessage(cmake::INTERNAL_ERROR, msg);
|
||||
}
|
||||
|
||||
// This versioning is supported only for executables and then only
|
||||
// when the platform supports symbolic links.
|
||||
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||
const char* version = 0;
|
||||
#else
|
||||
// Check for executable version properties.
|
||||
const char* version = this->GetProperty("VERSION");
|
||||
if(this->GetType() != cmTarget::EXECUTABLE || this->Makefile->IsOn("XCODE"))
|
||||
{
|
||||
version = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Get the components of the executable name.
|
||||
std::string prefix;
|
||||
std::string base;
|
||||
std::string suffix;
|
||||
this->GetFullNameInternal(config, false, prefix, base, suffix);
|
||||
|
||||
// The executable name.
|
||||
name = prefix+base+suffix;
|
||||
|
||||
// The executable's real name on disk.
|
||||
#if defined(__CYGWIN__)
|
||||
realName = prefix+base;
|
||||
#else
|
||||
realName = name;
|
||||
#endif
|
||||
if(version)
|
||||
{
|
||||
realName += "-";
|
||||
realName += version;
|
||||
}
|
||||
#if defined(__CYGWIN__)
|
||||
realName += suffix;
|
||||
#endif
|
||||
|
||||
// The import library name.
|
||||
impName = this->GetFullNameInternal(config, true);
|
||||
|
||||
// The program database file name.
|
||||
pdbName = this->GetPDBName(config);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool cmTarget::HasImplibGNUtoMS() const
|
||||
{
|
||||
|
|
|
@ -406,14 +406,6 @@ public:
|
|||
std::string& realName, std::string& impName,
|
||||
std::string& pdbName, const std::string& config) const;
|
||||
|
||||
/** Get the names of the executable needed to generate a build rule
|
||||
that takes into account executable version numbers. This should
|
||||
be called only on an executable target. */
|
||||
void GetExecutableNames(std::string& name, std::string& realName,
|
||||
std::string& impName,
|
||||
std::string& pdbName,
|
||||
const std::string& config) const;
|
||||
|
||||
/** Does this target have a GNU implib to convert to MS format? */
|
||||
bool HasImplibGNUtoMS() const;
|
||||
|
||||
|
|
|
@ -2471,7 +2471,7 @@ cmVisualStudio10TargetGenerator::ComputeLinkOptions(std::string const& config)
|
|||
std::string targetNamePDB;
|
||||
if(this->Target->GetType() == cmTarget::EXECUTABLE)
|
||||
{
|
||||
this->Target->GetExecutableNames(targetName, targetNameFull,
|
||||
this->GeneratorTarget->GetExecutableNames(targetName, targetNameFull,
|
||||
targetNameImport, targetNamePDB,
|
||||
config.c_str());
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue