From 96db7986279c65c5e07afee432f49532a8590d57 Mon Sep 17 00:00:00 2001 From: Bill Hoffman Date: Thu, 28 Feb 2002 15:42:13 -0500 Subject: [PATCH] use xml output quotes for paths --- Source/cmMSDotNETGenerator.cxx | 54 +++++++++++++--------------------- Source/cmMSDotNETGenerator.h | 3 +- 2 files changed, 22 insertions(+), 35 deletions(-) diff --git a/Source/cmMSDotNETGenerator.cxx b/Source/cmMSDotNETGenerator.cxx index 521f27d0c..9ea195d0c 100644 --- a/Source/cmMSDotNETGenerator.cxx +++ b/Source/cmMSDotNETGenerator.cxx @@ -25,6 +25,7 @@ + cmMSDotNETGenerator::cmMSDotNETGenerator() { // default to building a sln project file @@ -533,8 +534,6 @@ void cmMSDotNETGenerator::OutputVCProjFile() { m_LibraryOutputPath += "/"; } - m_LibraryOutputPath = - cmSystemTools::ConvertToOutputPath(m_LibraryOutputPath.c_str()); } m_ExecutableOutputPath = ""; if (m_Makefile->GetDefinition("EXECUTABLE_OUTPUT_PATH")) @@ -549,25 +548,6 @@ void cmMSDotNETGenerator::OutputVCProjFile() m_ExecutableOutputPath += "/"; } } - m_ExecutableOutputPath = - cmSystemTools::ConvertToOutputPath(m_ExecutableOutputPath.c_str()); - - std::vector& includes = m_Makefile->GetIncludeDirectories(); - std::vector::iterator i; - for(i = includes.begin(); i != includes.end(); ++i) - { - std::string tmp = cmSystemTools::ConvertToOutputPath(i->c_str()); - m_IncludeOptions += ","; - // quote if not already quoted - if (tmp[0] != '"') - { - m_IncludeOptions += tmp; - } - else - { - m_IncludeOptions += tmp; - } - } // Create the VCProj or set of VCProj's for libraries and executables @@ -739,13 +719,10 @@ void cmMSDotNETGenerator::WriteConfiguration(std::ostream& fout, fout << "\t\t\t\tAdditionalIncludeDirectories=\""; std::vector& includes = m_Makefile->GetIncludeDirectories(); std::vector::iterator i = includes.begin(); - if(i != includes.end()) - { - fout << """ << cmSystemTools::ConvertToOutputPath(i->c_str()) << """; - } for(;i != includes.end(); ++i) { - fout << ";"" << cmSystemTools::ConvertToOutputPath(i->c_str()) << """; + std::string ipath = this->ConvertToXMLOutputPath(i->c_str()); + fout << ipath << ";"; } fout << "\"\n"; @@ -823,11 +800,13 @@ void cmMSDotNETGenerator::OutputBuildTool(std::ostream& fout, switch(target.GetType()) { case cmTarget::STATIC_LIBRARY: + { + std::string libpath = m_LibraryOutputPath + "$(OutDir)/" + libName + ".lib"; fout << "\t\t\t\n"; + << "\t\t\t\t\tOutputFile=\"" << this->ConvertToXMLOutputPath(libpath.c_str()) << ".\"/>\n"; break; + } case cmTarget::SHARED_LIBRARY: case cmTarget::MODULE_LIBRARY: break; @@ -894,7 +873,7 @@ void cmMSDotNETGenerator::OutputLibraryDirectories(std::ostream& fout, std::vector& libdirs = m_Makefile->GetLinkDirectories(); for(i = libdirs.begin(); i != libdirs.end(); ++i) { - std::string lpath = cmSystemTools::ConvertToOutputPath(i->c_str()); + std::string lpath = *i; if(lpath[lpath.size()-1] != '/') { lpath += "/"; @@ -905,7 +884,8 @@ void cmMSDotNETGenerator::OutputLibraryDirectories(std::ostream& fout, { fout << ","; } - fout << lpath << "\\$(INTDIR)," << lpath; + std::string lpathi = lpath + "$(INTDIR)"; + fout << this->ConvertToXMLOutputPath(lpathi.c_str()) << "," << lpath; hasone = true; } } @@ -925,7 +905,7 @@ void cmMSDotNETGenerator::OutputLibraries(std::ostream& fout, { lib += ".lib"; } - lib = cmSystemTools::ConvertToOutputPath(lib.c_str()); + lib = this->ConvertToXMLOutputPath(lib.c_str()); if (j->second == cmTarget::GENERAL || (j->second == cmTarget::DEBUG && strcmp(configName, "DEBUG") == 0) || (j->second == cmTarget::OPTIMIZED && strcmp(configName, "DEBUG") != 0)) @@ -1042,7 +1022,7 @@ void cmMSDotNETGenerator::WriteVCProjFile(std::ostream& fout, if (source != libName || target.GetType() == cmTarget::UTILITY) { fout << "\t\t\tConvertToXMLOutputPath(source.c_str()); // Tell MS-Dev what the source is. If the compiler knows how to // build it, then it will. fout << "\t\t\t\tRelativePath=\"" << d << "\">\n"; @@ -1095,7 +1075,7 @@ void cmMSDotNETGenerator::WriteCustomRule(std::ostream& fout, for(std::set::const_iterator d = depends.begin(); d != depends.end(); ++d) { - fout << cmSystemTools::ConvertToOutputPath(d->c_str()) + fout << this->ConvertToXMLOutputPath(d->c_str()) << ";"; } fout << "\"\n"; @@ -1242,3 +1222,11 @@ void cmMSDotNETGenerator::WriteVCProjFooter(std::ostream& fout) << "\t\n" << "\n"; } + + +std::string cmMSDotNETGenerator::ConvertToXMLOutputPath(const char* path) +{ + std::string ret = cmSystemTools::ConvertToOutputPath(path); + cmSystemTools::ReplaceString(ret, "\"", """); + return ret; +} diff --git a/Source/cmMSDotNETGenerator.h b/Source/cmMSDotNETGenerator.h index 02770ca39..0c4650d01 100644 --- a/Source/cmMSDotNETGenerator.h +++ b/Source/cmMSDotNETGenerator.h @@ -146,13 +146,12 @@ private: const char* configName, const char* libName, const cmTarget &target); - + std::string ConvertToXMLOutputPath(const char* path); private: std::map m_GUIDMap; bool m_BuildSLN; std::string m_LibraryOutputPath; std::string m_ExecutableOutputPath; - std::string m_IncludeOptions; std::vector m_Configurations; std::string m_VCProjHeaderTemplate; std::string m_VCProjFooterTemplate;