diff --git a/Source/cmDSPWriter.cxx b/Source/cmDSPWriter.cxx index a3bc7e9a0..1fa6bce56 100644 --- a/Source/cmDSPWriter.cxx +++ b/Source/cmDSPWriter.cxx @@ -549,6 +549,17 @@ cmDSPWriter::CreateTargetRules(const cmTarget &target, return customRuleCode; } + +inline std::string removeQuotes(const std::string& s) +{ + if(s[0] == '\"' && s[s.size()-1] == '\"') + { + return s.substr(1, s.size()-2); + } + return s; +} + + void cmDSPWriter::WriteDSPHeader(std::ostream& fout, const char *libName, const cmTarget &target, std::vector &) @@ -585,20 +596,22 @@ void cmDSPWriter::WriteDSPHeader(std::ostream& fout, const char *libName, } std::string lpath = cmSystemTools::ConvertToOutputPath(libPath.c_str()); + std::string lpathIntDir = libPath + "$(INTDIR)"; + lpathIntDir = cmSystemTools::ConvertToOutputPath(lpathIntDir.c_str()); if(pathEmitted.insert(lpath).second) { - libOptions += " /LIBPATH:\""; + libOptions += " /LIBPATH:"; + libOptions += lpathIntDir; + libOptions += " "; + libOptions += " /LIBPATH:"; libOptions += lpath; - libOptions += "$(INTDIR)\" "; - libOptions += " /LIBPATH:\""; - libOptions += lpath; - libOptions += "\" "; - libMultiLineOptions += "# ADD LINK32 /LIBPATH:\""; + libOptions += " "; + libMultiLineOptions += "# ADD LINK32 /LIBPATH:"; + libMultiLineOptions += lpathIntDir; + libMultiLineOptions += " "; + libMultiLineOptions += " /LIBPATH:"; libMultiLineOptions += lpath; - libMultiLineOptions += "$(INTDIR)\" "; - libMultiLineOptions += " /LIBPATH:\""; - libMultiLineOptions += lpath; - libMultiLineOptions += "\" \n"; + libMultiLineOptions += " \n"; } } if(exePath.size()) @@ -610,47 +623,53 @@ void cmDSPWriter::WriteDSPHeader(std::ostream& fout, const char *libName, } std::string lpath = cmSystemTools::ConvertToOutputPath(exePath.c_str()); + std::string lpathIntDir = exePath + "$(INTDIR)"; + lpathIntDir = cmSystemTools::ConvertToOutputPath(lpathIntDir.c_str()); + if(pathEmitted.insert(lpath).second) { - libOptions += " /LIBPATH:\""; + libOptions += " /LIBPATH:"; + libOptions += lpathIntDir; + libOptions += " "; + libOptions += " /LIBPATH:"; libOptions += lpath; - libOptions += "$(INTDIR)\" "; - libOptions += " /LIBPATH:\""; - libOptions += lpath; - libOptions += "\" "; - libMultiLineOptions += "# ADD LINK32 /LIBPATH:\""; + libOptions += " "; + libMultiLineOptions += "# ADD LINK32 /LIBPATH:"; + libMultiLineOptions += lpathIntDir; + libMultiLineOptions += " "; + libMultiLineOptions += " /LIBPATH:"; libMultiLineOptions += lpath; - libMultiLineOptions += "$(INTDIR)\" "; - libMultiLineOptions += " /LIBPATH:\""; - libMultiLineOptions += lpath; - libMultiLineOptions += "\" \n"; + libMultiLineOptions += " \n"; } } std::vector::iterator i; std::vector& libdirs = m_Makefile->GetLinkDirectories(); for(i = libdirs.begin(); i != libdirs.end(); ++i) { - std::string lpath = - cmSystemTools::ConvertToOutputPath(i->c_str()); - if(lpath[lpath.size()-1] != '/') + std::string path = *i; + if(path[path.size()-1] != '/') { - lpath += "/"; + path += "/"; } + std::string lpath = + cmSystemTools::ConvertToOutputPath(path.c_str()); + std::string lpathIntDir = path + "$(INTDIR)"; + lpathIntDir = cmSystemTools::ConvertToOutputPath(lpathIntDir.c_str()); if(pathEmitted.insert(lpath).second) { - libOptions += " /LIBPATH:\""; + libOptions += " /LIBPATH:"; + libOptions += lpathIntDir; + libOptions += " "; + libOptions += " /LIBPATH:"; libOptions += lpath; - libOptions += "/$(INTDIR)\" "; - libOptions += " /LIBPATH:\""; - libOptions += lpath; - libOptions += "\" "; + libOptions += " "; - libMultiLineOptions += "# ADD LINK32 /LIBPATH:\""; + libMultiLineOptions += "# ADD LINK32 /LIBPATH:"; + libMultiLineOptions += lpathIntDir; + libMultiLineOptions += " "; + libMultiLineOptions += " /LIBPATH:"; libMultiLineOptions += lpath; - libMultiLineOptions += "/$(INTDIR)\" "; - libMultiLineOptions += " /LIBPATH:\""; - libMultiLineOptions += lpath; - libMultiLineOptions += "\" \n"; + libMultiLineOptions += " \n"; } } @@ -754,10 +773,16 @@ void cmDSPWriter::WriteDSPHeader(std::ostream& fout, const char *libName, cmSystemTools::ReplaceString(line, "BUILD_INCLUDES", m_IncludeOptions.c_str()); cmSystemTools::ReplaceString(line, "OUTPUT_LIBNAME",libName); + // because LIBRARY_OUTPUT_PATH and EXECUTABLE_OUTPUT_PATH + // are already quoted in the template file, + // we need to remove the quotes here, we still need + // to convert to output path for unix to win32 conversion cmSystemTools::ReplaceString(line, "LIBRARY_OUTPUT_PATH", - cmSystemTools::ConvertToOutputPath(libPath.c_str()).c_str()); + removeQuotes( + cmSystemTools::ConvertToOutputPath(libPath.c_str())).c_str()); cmSystemTools::ReplaceString(line, "EXECUTABLE_OUTPUT_PATH", - cmSystemTools::ConvertToOutputPath(exePath.c_str()).c_str()); + removeQuotes( + cmSystemTools::ConvertToOutputPath(exePath.c_str())).c_str()); cmSystemTools::ReplaceString(line, "EXTRA_DEFINES", m_Makefile->GetDefineFlags()); diff --git a/Source/cmDSWWriter.cxx b/Source/cmDSWWriter.cxx index 36abbc51a..9c719ff2c 100644 --- a/Source/cmDSWWriter.cxx +++ b/Source/cmDSWWriter.cxx @@ -64,6 +64,16 @@ void cmDSWWriter::OutputDSWFile() } +inline std::string removeQuotes(const std::string& s) +{ + if(s[0] == '\"' && s[s.size()-1] == '\"') + { + return s.substr(1, s.size()-2); + } + return s; +} + + // Write a DSW file to the stream void cmDSWWriter::WriteDSWFile(std::ostream& fout) { @@ -81,6 +91,7 @@ void cmDSWWriter::WriteDSWFile(std::ostream& fout) m_Makefile->AddUtilityCommand("ALL_BUILD", "echo", "\"Build all projects\"", false); std::string ctest = m_Makefile->GetDefinition("CMAKE_COMMAND"); + ctest = removeQuotes(ctest); ctest = cmSystemTools::GetFilenamePath(ctest.c_str()); ctest += "/"; ctest += "ctest";