diff options
author | Brad King <brad.king@kitware.com> | 2007-02-01 14:57:24 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2007-02-01 14:57:24 (GMT) |
commit | 712345ffc4614467671fd5948fb80d711ae28994 (patch) | |
tree | e76883b82f308ef9acd1eb8e1d36e9fca9514d11 /Source/cmLocalVisualStudio7Generator.cxx | |
parent | 9d217a94e5745b3c620b94b8d9a4abb1100c514b (diff) | |
download | CMake-712345ffc4614467671fd5948fb80d711ae28994.zip CMake-712345ffc4614467671fd5948fb80d711ae28994.tar.gz CMake-712345ffc4614467671fd5948fb80d711ae28994.tar.bz2 |
BUG: The .pdb file generated for a library or executable should match the real file name used for the target. This addresses bug#3277.
Diffstat (limited to 'Source/cmLocalVisualStudio7Generator.cxx')
-rw-r--r-- | Source/cmLocalVisualStudio7Generator.cxx | 78 |
1 files changed, 61 insertions, 17 deletions
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index 2efeb9c..0289f97 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -568,9 +568,32 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout, flagMap.find("DebugInformationFormat"); if(mi != flagMap.end() && mi->second != "1") { - fout << "\t\t\t\tProgramDataBaseFileName=\"" - << this->LibraryOutputPath - << "$(OutDir)/" << libName << ".pdb\"\n"; + 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)/" << 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"; - fout << "\t\t\t\tImportLibrary=\"" + 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) { |