BUG: The .pdb file generated for a library or executable should match the real file name used for the target. This addresses bug#3277.
This commit is contained in:
parent
9d217a94e5
commit
712345ffc4
|
@ -208,8 +208,9 @@ cmInstallTargetGenerator
|
|||
std::string targetNameSO;
|
||||
std::string targetNameReal;
|
||||
std::string targetNameImport;
|
||||
std::string targetNamePDB;
|
||||
target->GetLibraryNames(targetName, targetNameSO, targetNameReal,
|
||||
targetNameImport, i->c_str());
|
||||
targetNameImport, targetNamePDB, i->c_str());
|
||||
if(this->ImportLibrary)
|
||||
{
|
||||
// Use the import library name.
|
||||
|
@ -245,8 +246,10 @@ std::string cmInstallTargetGenerator::GetScriptReference(cmTarget* target,
|
|||
std::string targetNameSO;
|
||||
std::string targetNameReal;
|
||||
std::string targetNameImport;
|
||||
std::string targetNamePDB;
|
||||
target->GetLibraryNames(targetName, targetNameSO, targetNameReal,
|
||||
targetNameImport, this->ConfigurationName);
|
||||
targetNameImport, targetNamePDB,
|
||||
this->ConfigurationName);
|
||||
if(this->ImportLibrary)
|
||||
{
|
||||
// Use the import library name.
|
||||
|
|
|
@ -1691,8 +1691,9 @@ cmLocalUnixMakefileGenerator3
|
|||
objectName = cmSystemTools::GetFilenameName(objectName.c_str());
|
||||
std::string targetName;
|
||||
std::string targetNameReal;
|
||||
std::string targetNamePDB;
|
||||
target.GetExecutableNames(targetName, targetNameReal,
|
||||
this->ConfigurationName.c_str());
|
||||
targetNamePDB, this->ConfigurationName.c_str());
|
||||
if ( target.GetPropertyAsBool("MACOSX_BUNDLE") )
|
||||
{
|
||||
// Construct the full path version of the names.
|
||||
|
|
|
@ -568,9 +568,32 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout,
|
|||
flagMap.find("DebugInformationFormat");
|
||||
if(mi != flagMap.end() && mi->second != "1")
|
||||
{
|
||||
if(target.GetType() == cmTarget::EXECUTABLE)
|
||||
{
|
||||
std::string targetName;
|
||||
std::string targetNameFull;
|
||||
std::string targetNamePDB;
|
||||
target.GetExecutableNames(targetName, targetNameFull,
|
||||
targetNamePDB, configName);
|
||||
fout << "\t\t\t\tProgramDataBaseFileName=\""
|
||||
<< this->ExecutableOutputPath
|
||||
<< "$(OutDir)/" << targetNamePDB << "\"\n";
|
||||
}
|
||||
else if(target.GetType() == cmTarget::STATIC_LIBRARY ||
|
||||
target.GetType() == cmTarget::SHARED_LIBRARY ||
|
||||
target.GetType() == cmTarget::MODULE_LIBRARY)
|
||||
{
|
||||
std::string targetName;
|
||||
std::string targetNameSO;
|
||||
std::string targetNameFull;
|
||||
std::string targetNameImport;
|
||||
std::string targetNamePDB;
|
||||
target.GetLibraryNames(targetName, targetNameSO, targetNameFull,
|
||||
targetNameImport, targetNamePDB, configName);
|
||||
fout << "\t\t\t\tProgramDataBaseFileName=\""
|
||||
<< this->LibraryOutputPath
|
||||
<< "$(OutDir)/" << libName << ".pdb\"\n";
|
||||
<< "$(OutDir)/" << targetNamePDB << "\"\n";
|
||||
}
|
||||
}
|
||||
fout << "/>\n"; // end of <Tool Name=VCCLCompilerTool
|
||||
fout << "\t\t\t<Tool\n\t\t\t\tName=\"VCCustomBuildTool\"/>\n";
|
||||
|
@ -625,7 +648,7 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout,
|
|||
}
|
||||
|
||||
this->OutputTargetRules(fout, target, libName);
|
||||
this->OutputBuildTool(fout, configName, libName, target);
|
||||
this->OutputBuildTool(fout, configName, target);
|
||||
fout << "\t\t</Configuration>\n";
|
||||
}
|
||||
void cmLocalVisualStudio7Generator::ReplaceFlagSetMap(std::string& flags,
|
||||
|
@ -725,10 +748,8 @@ cmLocalVisualStudio7Generator
|
|||
|
||||
void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout,
|
||||
const char* configName,
|
||||
const char *libName,
|
||||
cmTarget &target)
|
||||
{
|
||||
std::string targetFullName = target.GetFullName(configName);
|
||||
std::string temp;
|
||||
std::string extraLinkOptions;
|
||||
if(target.GetType() == cmTarget::EXECUTABLE)
|
||||
|
@ -776,8 +797,9 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout,
|
|||
{
|
||||
case cmTarget::STATIC_LIBRARY:
|
||||
{
|
||||
std::string targetNameFull = target.GetFullName(configName);
|
||||
std::string libpath = this->LibraryOutputPath +
|
||||
"$(OutDir)/" + targetFullName;
|
||||
"$(OutDir)/" + targetNameFull;
|
||||
fout << "\t\t\t<Tool\n"
|
||||
<< "\t\t\t\tName=\"VCLibrarianTool\"\n";
|
||||
if(const char* libflags = target.GetProperty("STATIC_LIBRARY_FLAGS"))
|
||||
|
@ -791,6 +813,25 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout,
|
|||
case cmTarget::SHARED_LIBRARY:
|
||||
case cmTarget::MODULE_LIBRARY:
|
||||
{
|
||||
std::string targetName;
|
||||
std::string targetNameSO;
|
||||
std::string targetNameFull;
|
||||
std::string targetNameImport;
|
||||
std::string targetNamePDB;
|
||||
target.GetLibraryNames(targetName, targetNameSO, targetNameFull,
|
||||
targetNameImport, targetNamePDB, configName);
|
||||
|
||||
// VS does not distinguish between shared libraries and module
|
||||
// libraries so it still wants to be given the name of an import
|
||||
// library for modules.
|
||||
if(targetNameImport.empty() &&
|
||||
target.GetType() == cmTarget::MODULE_LIBRARY)
|
||||
{
|
||||
targetNameImport =
|
||||
cmSystemTools::GetFilenameWithoutLastExtension(targetNameFull);
|
||||
targetNameImport += ".lib";
|
||||
}
|
||||
|
||||
// Compute the link library and directory information.
|
||||
std::vector<cmStdString> linkLibs;
|
||||
std::vector<cmStdString> linkDirs;
|
||||
|
@ -832,7 +873,7 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout,
|
|||
temp = this->LibraryOutputPath;
|
||||
temp += configName;
|
||||
temp += "/";
|
||||
temp += targetFullName;
|
||||
temp += targetNameFull;
|
||||
fout << "\t\t\t\tOutputFile=\""
|
||||
<< this->ConvertToXMLOutputPathSingle(temp.c_str()) << "\"\n";
|
||||
this->WriteTargetVersionAttribute(fout, target);
|
||||
|
@ -847,8 +888,7 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout,
|
|||
this->OutputModuleDefinitionFile(fout, target);
|
||||
temp = this->LibraryOutputPath;
|
||||
temp += "$(OutDir)/";
|
||||
temp += libName;
|
||||
temp += ".pdb";
|
||||
temp += targetNamePDB;
|
||||
fout << "\t\t\t\tProgramDataBaseFile=\"" <<
|
||||
this->ConvertToXMLOutputPathSingle(temp.c_str()) << "\"\n";
|
||||
if(strcmp(configName, "Debug") == 0
|
||||
|
@ -867,15 +907,19 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout,
|
|||
temp = this->LibraryOutputPath;
|
||||
temp += configName;
|
||||
temp += "/";
|
||||
temp +=
|
||||
cmSystemTools::GetFilenameWithoutLastExtension(targetFullName.c_str());
|
||||
temp += ".lib";
|
||||
temp += targetNameImport;
|
||||
fout << "\t\t\t\tImportLibrary=\""
|
||||
<< this->ConvertToXMLOutputPathSingle(temp.c_str()) << "\"/>\n";
|
||||
}
|
||||
break;
|
||||
case cmTarget::EXECUTABLE:
|
||||
{
|
||||
std::string targetName;
|
||||
std::string targetNameFull;
|
||||
std::string targetNamePDB;
|
||||
target.GetExecutableNames(targetName, targetNameFull,
|
||||
targetNamePDB, configName);
|
||||
|
||||
// Compute the link library and directory information.
|
||||
std::vector<cmStdString> linkLibs;
|
||||
std::vector<cmStdString> linkDirs;
|
||||
|
@ -917,7 +961,7 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout,
|
|||
temp = this->ExecutableOutputPath;
|
||||
temp += configName;
|
||||
temp += "/";
|
||||
temp += targetFullName;
|
||||
temp += targetNameFull;
|
||||
fout << "\t\t\t\tOutputFile=\""
|
||||
<< this->ConvertToXMLOutputPathSingle(temp.c_str()) << "\"\n";
|
||||
this->WriteTargetVersionAttribute(fout, target);
|
||||
|
@ -929,8 +973,8 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout,
|
|||
fout << "\t\t\t\tAdditionalLibraryDirectories=\"";
|
||||
this->OutputLibraryDirectories(fout, linkDirs);
|
||||
fout << "\"\n";
|
||||
fout << "\t\t\t\tProgramDataBaseFile=\"" << this->LibraryOutputPath
|
||||
<< "$(OutDir)\\" << libName << ".pdb\"\n";
|
||||
fout << "\t\t\t\tProgramDataBaseFile=\"" << this->ExecutableOutputPath
|
||||
<< "$(OutDir)\\" << targetNamePDB << "\"\n";
|
||||
if(strcmp(configName, "Debug") == 0
|
||||
|| strcmp(configName, "RelWithDebInfo") == 0)
|
||||
{
|
||||
|
|
|
@ -101,7 +101,7 @@ private:
|
|||
void OutputTargetRules(std::ostream& fout, cmTarget &target,
|
||||
const char *libName);
|
||||
void OutputBuildTool(std::ostream& fout, const char* configName,
|
||||
const char* libname, cmTarget& t);
|
||||
cmTarget& t);
|
||||
void OutputLibraries(std::ostream& fout,
|
||||
std::vector<cmStdString> const& libs);
|
||||
void OutputLibraryDirectories(std::ostream& fout,
|
||||
|
|
|
@ -110,8 +110,9 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
|
|||
// Get the name of the executable to generate.
|
||||
std::string targetName;
|
||||
std::string targetNameReal;
|
||||
std::string targetNamePDB;
|
||||
this->Target->GetExecutableNames
|
||||
(targetName, targetNameReal,
|
||||
(targetName, targetNameReal, targetNamePDB,
|
||||
this->LocalGenerator->ConfigurationName.c_str());
|
||||
|
||||
// Construct the full path version of the names.
|
||||
|
@ -187,8 +188,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
|
|||
}
|
||||
std::string targetFullPath = outpath + targetName;
|
||||
std::string targetFullPathReal = outpath + targetNameReal;
|
||||
std::string targetFullPathPDB = outpath + this->Target->GetName();
|
||||
targetFullPathPDB += ".pdb";
|
||||
std::string targetFullPathPDB = outpath + targetNamePDB;
|
||||
std::string targetOutPathPDB =
|
||||
this->Convert(targetFullPathPDB.c_str(),
|
||||
cmLocalGenerator::FULL,
|
||||
|
@ -269,12 +269,14 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
|
|||
{
|
||||
std::string cleanName;
|
||||
std::string cleanRealName;
|
||||
std::string cleanPDBName;
|
||||
this->Target->GetExecutableCleanNames
|
||||
(cleanName, cleanRealName,
|
||||
(cleanName, cleanRealName, cleanPDBName,
|
||||
this->LocalGenerator->ConfigurationName.c_str());
|
||||
|
||||
std::string cleanFullName = outpath + cleanName;
|
||||
std::string cleanFullRealName = outpath + cleanRealName;
|
||||
std::string cleanFullPDBName = outpath + cleanPDBName;
|
||||
exeCleanFiles.push_back(this->Convert(cleanFullName.c_str(),
|
||||
cmLocalGenerator::START_OUTPUT,
|
||||
cmLocalGenerator::UNCHANGED));
|
||||
|
@ -291,6 +293,9 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
|
|||
cmLocalGenerator::START_OUTPUT,
|
||||
cmLocalGenerator::UNCHANGED));
|
||||
}
|
||||
exeCleanFiles.push_back(this->Convert(cleanPDBName.c_str(),
|
||||
cmLocalGenerator::START_OUTPUT,
|
||||
cmLocalGenerator::UNCHANGED));
|
||||
}
|
||||
|
||||
// Add a command to remove any existing files for this executable.
|
||||
|
|
|
@ -239,8 +239,9 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
|
|||
std::string targetNameSO;
|
||||
std::string targetNameReal;
|
||||
std::string targetNameImport;
|
||||
std::string targetNamePDB;
|
||||
this->Target->GetLibraryNames(
|
||||
targetName, targetNameSO, targetNameReal, targetNameImport,
|
||||
targetName, targetNameSO, targetNameReal, targetNameImport, targetNamePDB,
|
||||
this->LocalGenerator->ConfigurationName.c_str());
|
||||
|
||||
// Construct the full path version of the names.
|
||||
|
@ -259,8 +260,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
|
|||
outpath += "/";
|
||||
}
|
||||
std::string targetFullPath = outpath + targetName;
|
||||
std::string targetFullPathPDB =
|
||||
outpath + this->Target->GetName() + std::string(".pdb");
|
||||
std::string targetFullPathPDB = outpath + targetNamePDB;
|
||||
std::string targetFullPathSO = outpath + targetNameSO;
|
||||
std::string targetFullPathReal = outpath + targetNameReal;
|
||||
std::string targetFullPathImport = outpath + targetNameImport;
|
||||
|
@ -351,18 +351,21 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
|
|||
std::string cleanSharedSOName;
|
||||
std::string cleanSharedRealName;
|
||||
std::string cleanImportName;
|
||||
std::string cleanPDBName;
|
||||
this->Target->GetLibraryCleanNames(
|
||||
cleanStaticName,
|
||||
cleanSharedName,
|
||||
cleanSharedSOName,
|
||||
cleanSharedRealName,
|
||||
cleanImportName,
|
||||
cleanPDBName,
|
||||
this->LocalGenerator->ConfigurationName.c_str());
|
||||
std::string cleanFullStaticName = outpath + cleanStaticName;
|
||||
std::string cleanFullSharedName = outpath + cleanSharedName;
|
||||
std::string cleanFullSharedSOName = outpath + cleanSharedSOName;
|
||||
std::string cleanFullSharedRealName = outpath + cleanSharedRealName;
|
||||
std::string cleanFullImportName = outpath + cleanImportName;
|
||||
std::string cleanFullPDBName = outpath + cleanPDBName;
|
||||
libCleanFiles.push_back
|
||||
(this->Convert(cleanFullStaticName.c_str(),
|
||||
cmLocalGenerator::START_OUTPUT,
|
||||
|
@ -398,6 +401,10 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
|
|||
cmLocalGenerator::START_OUTPUT,
|
||||
cmLocalGenerator::UNCHANGED));
|
||||
}
|
||||
libCleanFiles.push_back
|
||||
(this->Convert(cleanFullPDBName.c_str(),
|
||||
cmLocalGenerator::START_OUTPUT,
|
||||
cmLocalGenerator::UNCHANGED));
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
|
|
|
@ -1541,10 +1541,11 @@ void cmTarget::GetLibraryNames(std::string& name,
|
|||
std::string& soName,
|
||||
std::string& realName,
|
||||
std::string& impName,
|
||||
std::string& pdbName,
|
||||
const char* config)
|
||||
{
|
||||
// Get the names based on the real type of the library.
|
||||
this->GetLibraryNamesInternal(name, soName, realName, impName,
|
||||
this->GetLibraryNamesInternal(name, soName, realName, impName, pdbName,
|
||||
this->GetType(), config);
|
||||
}
|
||||
|
||||
|
@ -1553,6 +1554,7 @@ void cmTarget::GetLibraryCleanNames(std::string& staticName,
|
|||
std::string& sharedSOName,
|
||||
std::string& sharedRealName,
|
||||
std::string& importName,
|
||||
std::string& pdbName,
|
||||
const char* config)
|
||||
{
|
||||
// Get the name as if this were a static library.
|
||||
|
@ -1560,7 +1562,7 @@ void cmTarget::GetLibraryCleanNames(std::string& staticName,
|
|||
std::string realName;
|
||||
std::string impName;
|
||||
this->GetLibraryNamesInternal(staticName, soName, realName, impName,
|
||||
cmTarget::STATIC_LIBRARY, config);
|
||||
pdbName, cmTarget::STATIC_LIBRARY, config);
|
||||
|
||||
// Get the names as if this were a shared library.
|
||||
if(this->GetType() == cmTarget::STATIC_LIBRARY)
|
||||
|
@ -1571,14 +1573,15 @@ void cmTarget::GetLibraryCleanNames(std::string& staticName,
|
|||
// type will never be MODULE. Either way the only names that
|
||||
// might have to be cleaned are the shared library names.
|
||||
this->GetLibraryNamesInternal(sharedName, sharedSOName, sharedRealName,
|
||||
importName, cmTarget::SHARED_LIBRARY,
|
||||
config);
|
||||
importName, pdbName,
|
||||
cmTarget::SHARED_LIBRARY, config);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Use the name of the real type of the library (shared or module).
|
||||
this->GetLibraryNamesInternal(sharedName, sharedSOName, sharedRealName,
|
||||
importName, this->GetType(), config);
|
||||
importName, pdbName, this->GetType(),
|
||||
config);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1586,6 +1589,7 @@ void cmTarget::GetLibraryNamesInternal(std::string& name,
|
|||
std::string& soName,
|
||||
std::string& realName,
|
||||
std::string& impName,
|
||||
std::string& pdbName,
|
||||
TargetType type,
|
||||
const char* config)
|
||||
{
|
||||
|
@ -1672,27 +1676,34 @@ void cmTarget::GetLibraryNamesInternal(std::string& name,
|
|||
{
|
||||
impName = "";
|
||||
}
|
||||
|
||||
// The program database file name.
|
||||
pdbName = prefix+base+".pdb";
|
||||
}
|
||||
|
||||
void cmTarget::GetExecutableNames(std::string& name,
|
||||
std::string& realName,
|
||||
std::string& pdbName,
|
||||
const char* config)
|
||||
{
|
||||
// Get the names based on the real type of the executable.
|
||||
this->GetExecutableNamesInternal(name, realName, this->GetType(), config);
|
||||
this->GetExecutableNamesInternal(name, realName, pdbName,
|
||||
this->GetType(), config);
|
||||
}
|
||||
|
||||
void cmTarget::GetExecutableCleanNames(std::string& name,
|
||||
std::string& realName,
|
||||
std::string& pdbName,
|
||||
const char* config)
|
||||
{
|
||||
// Get the name and versioned name of this executable.
|
||||
this->GetExecutableNamesInternal(name, realName, cmTarget::EXECUTABLE,
|
||||
config);
|
||||
this->GetExecutableNamesInternal(name, realName, pdbName,
|
||||
cmTarget::EXECUTABLE, config);
|
||||
}
|
||||
|
||||
void cmTarget::GetExecutableNamesInternal(std::string& name,
|
||||
std::string& realName,
|
||||
std::string& pdbName,
|
||||
TargetType type,
|
||||
const char* config)
|
||||
{
|
||||
|
@ -1732,6 +1743,9 @@ void cmTarget::GetExecutableNamesInternal(std::string& name,
|
|||
#if defined(__CYGWIN__)
|
||||
realName += suffix;
|
||||
#endif
|
||||
|
||||
// The program database file name.
|
||||
pdbName = prefix+base+".pdb";
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
|
|
@ -215,7 +215,7 @@ public:
|
|||
should be called only on a library target. */
|
||||
void GetLibraryNames(std::string& name, std::string& soName,
|
||||
std::string& realName, std::string& impName,
|
||||
const char* config);
|
||||
std::string& pdbName, const char* config);
|
||||
|
||||
/** Get the names of the library used to remove existing copies of
|
||||
the library from the build tree either before linking or during
|
||||
|
@ -226,20 +226,21 @@ public:
|
|||
std::string& sharedSOName,
|
||||
std::string& sharedRealName,
|
||||
std::string& importName,
|
||||
std::string& pdbName,
|
||||
const char* config);
|
||||
|
||||
/** 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,
|
||||
const char* config);
|
||||
std::string& pdbName, const char* config);
|
||||
|
||||
/** Get the names of the executable used to remove existing copies
|
||||
of the executable from the build tree either before linking or
|
||||
during a clean step. This should be called only on an
|
||||
executable target. */
|
||||
void GetExecutableCleanNames(std::string& name, std::string& realName,
|
||||
const char* config);
|
||||
std::string& pdbName, const char* config);
|
||||
|
||||
/**
|
||||
* Compute whether this target must be relinked before installing.
|
||||
|
@ -319,10 +320,12 @@ private:
|
|||
std::string& soName,
|
||||
std::string& realName,
|
||||
std::string& impName,
|
||||
std::string& pdbName,
|
||||
TargetType type,
|
||||
const char* config);
|
||||
void GetExecutableNamesInternal(std::string& name,
|
||||
std::string& realName,
|
||||
std::string& pdbName,
|
||||
TargetType type,
|
||||
const char* config);
|
||||
|
||||
|
|
Loading…
Reference in New Issue