ENH: Renamed cmStringStream to cmOStringStream and added cmIStringStream. Removed cmInputStringStream.
This commit is contained in:
parent
65cc289047
commit
281f7519e1
@ -35,7 +35,7 @@ bool cmCMakeMinimumRequired::InitialPass(std::vector<std::string> const& args)
|
|||||||
sscanf(args[1].c_str(), "%f", &reqVersion);
|
sscanf(args[1].c_str(), "%f", &reqVersion);
|
||||||
if(reqVersion > version)
|
if(reqVersion > version)
|
||||||
{
|
{
|
||||||
cmStringStream str;
|
cmOStringStream str;
|
||||||
str << "WARNING: This project requires version: " << args[1].c_str() << " of cmake.\n"
|
str << "WARNING: This project requires version: " << args[1].c_str() << " of cmake.\n"
|
||||||
<< "You are running version: " << version;
|
<< "You are running version: " << version;
|
||||||
cmSystemTools::Message(str.str().c_str());
|
cmSystemTools::Message(str.str().c_str());
|
||||||
|
@ -221,7 +221,7 @@ void cmLocalBorlandMakefileGenerator::OutputSharedLibraryRule(std::ostream& fout
|
|||||||
command += "-e";
|
command += "-e";
|
||||||
command += target;
|
command += target;
|
||||||
command += " ";
|
command += " ";
|
||||||
cmStringStream linklibs;
|
cmOStringStream linklibs;
|
||||||
this->OutputLinkLibraries(linklibs, name, t);
|
this->OutputLinkLibraries(linklibs, name, t);
|
||||||
// then the linker options -L and libraries (any other order will fail!)
|
// then the linker options -L and libraries (any other order will fail!)
|
||||||
command += linklibs.str();
|
command += linklibs.str();
|
||||||
@ -321,7 +321,7 @@ void cmLocalBorlandMakefileGenerator::OutputExecutableRule(std::ostream& fout,
|
|||||||
{
|
{
|
||||||
command += " -tWC ";
|
command += " -tWC ";
|
||||||
}
|
}
|
||||||
cmStringStream linklibs;
|
cmOStringStream linklibs;
|
||||||
this->OutputLinkLibraries(linklibs, 0, t);
|
this->OutputLinkLibraries(linklibs, 0, t);
|
||||||
command += linklibs.str();
|
command += linklibs.str();
|
||||||
command += " $(" + this->CreateMakeVariable(name, "_SRC_OBJS") + ")";
|
command += " $(" + this->CreateMakeVariable(name, "_SRC_OBJS") + ")";
|
||||||
|
@ -84,7 +84,7 @@ std::string cmLocalNMakeMakefileGenerator::ShortPathCommand(const char* command)
|
|||||||
cmRegularExpression removeIntDir("(.*)(/|\\\\)\\$\\(IntDir\\)(.*)");
|
cmRegularExpression removeIntDir("(.*)(/|\\\\)\\$\\(IntDir\\)(.*)");
|
||||||
if(removeIntDir.find(c))
|
if(removeIntDir.find(c))
|
||||||
{
|
{
|
||||||
c = removeIntDir.match(1) + removeIntDir.match(3);
|
c = removeIntDir.match(1) + removeIntDir.match(3);
|
||||||
}
|
}
|
||||||
std::string unixPath = c;
|
std::string unixPath = c;
|
||||||
// since the command may already be a windows path, convert it
|
// since the command may already be a windows path, convert it
|
||||||
@ -407,7 +407,7 @@ void cmLocalNMakeMakefileGenerator::OutputSharedLibraryRule(std::ostream& fout,
|
|||||||
|
|
||||||
command += " $(" + this->CreateMakeVariable(name, "_SRC_OBJS") + ") ";
|
command += " $(" + this->CreateMakeVariable(name, "_SRC_OBJS") + ") ";
|
||||||
|
|
||||||
cmStringStream linklibs;
|
cmOStringStream linklibs;
|
||||||
this->OutputLinkLibraries(linklibs, name, t);
|
this->OutputLinkLibraries(linklibs, name, t);
|
||||||
command += linklibs.str();
|
command += linklibs.str();
|
||||||
|
|
||||||
@ -528,7 +528,7 @@ void cmLocalNMakeMakefileGenerator::OutputExecutableRule(std::ostream& fout,
|
|||||||
command += " /subsystem:windows ";
|
command += " /subsystem:windows ";
|
||||||
}
|
}
|
||||||
|
|
||||||
cmStringStream linklibs;
|
cmOStringStream linklibs;
|
||||||
this->OutputLinkLibraries(linklibs, 0, t);
|
this->OutputLinkLibraries(linklibs, 0, t);
|
||||||
command += linklibs.str();
|
command += linklibs.str();
|
||||||
|
|
||||||
@ -614,16 +614,16 @@ void cmLocalNMakeMakefileGenerator::OutputLinkLibraries(std::ostream& fout,
|
|||||||
// if it ends in .lib, then it is a full path and should
|
// if it ends in .lib, then it is a full path and should
|
||||||
// be escaped, and does not need .lib added
|
// be escaped, and does not need .lib added
|
||||||
if(reg.find(lib->first))
|
if(reg.find(lib->first))
|
||||||
{
|
{
|
||||||
librariesLinked += ShortPath(lib->first.c_str());
|
librariesLinked += ShortPath(lib->first.c_str());
|
||||||
librariesLinked += " ";
|
librariesLinked += " ";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
librariesLinked += m_LibraryLinkOption;
|
librariesLinked += m_LibraryLinkOption;
|
||||||
librariesLinked += lib->first;
|
librariesLinked += lib->first;
|
||||||
librariesLinked += m_StaticLibraryExtension + " ";
|
librariesLinked += m_StaticLibraryExtension + " ";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
linkLibs += librariesLinked;
|
linkLibs += librariesLinked;
|
||||||
|
@ -347,7 +347,7 @@ void cmLocalUnixMakefileGenerator::OutputTargetRules(std::ostream& fout)
|
|||||||
l != tgts.end(); l++)
|
l != tgts.end(); l++)
|
||||||
{
|
{
|
||||||
if (l->second.GetType() == cmTarget::UTILITY &&
|
if (l->second.GetType() == cmTarget::UTILITY &&
|
||||||
l->second.IsInAll())
|
l->second.IsInAll())
|
||||||
{
|
{
|
||||||
fout << " \\\n" << l->first.c_str();
|
fout << " \\\n" << l->first.c_str();
|
||||||
}
|
}
|
||||||
@ -545,14 +545,14 @@ void cmLocalUnixMakefileGenerator::OutputLinkLibraries(std::ostream& fout,
|
|||||||
{
|
{
|
||||||
librariesLinked += "-l";
|
librariesLinked += "-l";
|
||||||
file = libname.match(1);
|
file = libname.match(1);
|
||||||
librariesLinked += file;
|
librariesLinked += file;
|
||||||
librariesLinked += " ";
|
librariesLinked += " ";
|
||||||
}
|
}
|
||||||
else if(libname_noprefix.find(file))
|
else if(libname_noprefix.find(file))
|
||||||
{
|
{
|
||||||
librariesLinked += "-l";
|
librariesLinked += "-l";
|
||||||
file = libname_noprefix.match(1);
|
file = libname_noprefix.match(1);
|
||||||
librariesLinked += file;
|
librariesLinked += file;
|
||||||
librariesLinked += " ";
|
librariesLinked += " ";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -652,7 +652,7 @@ void cmLocalUnixMakefileGenerator::OutputSharedLibraryRule(std::ostream& fout,
|
|||||||
libName = cmSystemTools::ConvertToOutputPath(libName.c_str());
|
libName = cmSystemTools::ConvertToOutputPath(libName.c_str());
|
||||||
command2 += libName + " \\\n";
|
command2 += libName + " \\\n";
|
||||||
command2 += "\t $(" + this->CreateMakeVariable(name, "_SRC_OBJS") + ") ";
|
command2 += "\t $(" + this->CreateMakeVariable(name, "_SRC_OBJS") + ") ";
|
||||||
cmStringStream linklibs;
|
cmOStringStream linklibs;
|
||||||
this->OutputLinkLibraries(linklibs, name, t);
|
this->OutputLinkLibraries(linklibs, name, t);
|
||||||
command2 += linklibs.str();
|
command2 += linklibs.str();
|
||||||
std::string customCommands = this->CreateTargetRules(t, name);
|
std::string customCommands = this->CreateTargetRules(t, name);
|
||||||
@ -694,7 +694,7 @@ void cmLocalUnixMakefileGenerator::OutputModuleLibraryRule(std::ostream& fout,
|
|||||||
libName = cmSystemTools::ConvertToOutputPath(libName.c_str());
|
libName = cmSystemTools::ConvertToOutputPath(libName.c_str());
|
||||||
command2 += libName + " \\\n";
|
command2 += libName + " \\\n";
|
||||||
command2 += "\t $(" + this->CreateMakeVariable(name, "_SRC_OBJS") + ") ";
|
command2 += "\t $(" + this->CreateMakeVariable(name, "_SRC_OBJS") + ") ";
|
||||||
cmStringStream linklibs;
|
cmOStringStream linklibs;
|
||||||
this->OutputLinkLibraries(linklibs, std::string(name).c_str(), t);
|
this->OutputLinkLibraries(linklibs, std::string(name).c_str(), t);
|
||||||
command2 += linklibs.str();
|
command2 += linklibs.str();
|
||||||
std::string customCommands = this->CreateTargetRules(t, name);
|
std::string customCommands = this->CreateTargetRules(t, name);
|
||||||
@ -771,7 +771,7 @@ void cmLocalUnixMakefileGenerator::OutputExecutableRule(std::ostream& fout,
|
|||||||
"$(CMAKE_C_COMPILER) $(CMAKE_C_SHLIB_LINK_FLAGS) $(CMAKE_C_FLAGS) ";
|
"$(CMAKE_C_COMPILER) $(CMAKE_C_SHLIB_LINK_FLAGS) $(CMAKE_C_FLAGS) ";
|
||||||
}
|
}
|
||||||
command += "$(" + this->CreateMakeVariable(name, "_SRC_OBJS") + ") ";
|
command += "$(" + this->CreateMakeVariable(name, "_SRC_OBJS") + ") ";
|
||||||
cmStringStream linklibs;
|
cmOStringStream linklibs;
|
||||||
this->OutputLinkLibraries(linklibs, 0, t);
|
this->OutputLinkLibraries(linklibs, 0, t);
|
||||||
command += linklibs.str();
|
command += linklibs.str();
|
||||||
std::string outputFile = m_ExecutableOutputPath + name;
|
std::string outputFile = m_ExecutableOutputPath + name;
|
||||||
@ -859,7 +859,7 @@ void cmLocalUnixMakefileGenerator::OutputTargets(std::ostream& fout)
|
|||||||
// This is handled by the OutputInstallRules method
|
// This is handled by the OutputInstallRules method
|
||||||
case cmTarget::INSTALL_PROGRAMS:
|
case cmTarget::INSTALL_PROGRAMS:
|
||||||
// This is handled by the OutputInstallRules method
|
// This is handled by the OutputInstallRules method
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1414,14 +1414,14 @@ void cmLocalUnixMakefileGenerator::OutputCustomRules(std::ostream& fout)
|
|||||||
// the custom command, as the command will be fired when the other target
|
// the custom command, as the command will be fired when the other target
|
||||||
// is built.
|
// is built.
|
||||||
if ( cr->GetSourceName().compare(tgt->first) !=0)
|
if ( cr->GetSourceName().compare(tgt->first) !=0)
|
||||||
{
|
{
|
||||||
cmSourceGroup& sourceGroup =
|
cmSourceGroup& sourceGroup =
|
||||||
m_Makefile->FindSourceGroup(cr->GetSourceName().c_str(),
|
m_Makefile->FindSourceGroup(cr->GetSourceName().c_str(),
|
||||||
sourceGroups);
|
sourceGroups);
|
||||||
cmCustomCommand cc(*cr);
|
cmCustomCommand cc(*cr);
|
||||||
cc.ExpandVariables(*m_Makefile);
|
cc.ExpandVariables(*m_Makefile);
|
||||||
sourceGroup.AddCustomCommand(cc);
|
sourceGroup.AddCustomCommand(cc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1622,53 +1622,53 @@ void cmLocalUnixMakefileGenerator::OutputInstallRules(std::ostream& fout)
|
|||||||
{
|
{
|
||||||
// first make the directories for each target
|
// first make the directories for each target
|
||||||
fout << "\t@if [ ! -d $(DESTDIR)" << prefix << l->second.GetInstallPath() <<
|
fout << "\t@if [ ! -d $(DESTDIR)" << prefix << l->second.GetInstallPath() <<
|
||||||
" ] ; then \\\n";
|
" ] ; then \\\n";
|
||||||
fout << "\t echo \"Making directory $(DESTDIR)" << prefix
|
fout << "\t echo \"Making directory $(DESTDIR)" << prefix
|
||||||
<< l->second.GetInstallPath() << " \"; \\\n";
|
<< l->second.GetInstallPath() << " \"; \\\n";
|
||||||
fout << "\t mkdir -p $(DESTDIR)" << prefix << l->second.GetInstallPath()
|
fout << "\t mkdir -p $(DESTDIR)" << prefix << l->second.GetInstallPath()
|
||||||
<< "; \\\n";
|
<< "; \\\n";
|
||||||
fout << "\t chmod 755 $(DESTDIR)" << prefix << l->second.GetInstallPath()
|
fout << "\t chmod 755 $(DESTDIR)" << prefix << l->second.GetInstallPath()
|
||||||
<< "; \\\n";
|
<< "; \\\n";
|
||||||
fout << "\t else true; \\\n";
|
fout << "\t else true; \\\n";
|
||||||
fout << "\t fi\n";
|
fout << "\t fi\n";
|
||||||
// now install the target
|
// now install the target
|
||||||
switch (l->second.GetType())
|
switch (l->second.GetType())
|
||||||
{
|
{
|
||||||
case cmTarget::STATIC_LIBRARY:
|
case cmTarget::STATIC_LIBRARY:
|
||||||
fout << "\t$(INSTALL_DATA) " << m_LibraryOutputPath << "lib"
|
fout << "\t$(INSTALL_DATA) " << m_LibraryOutputPath << "lib"
|
||||||
<< l->first;
|
<< l->first;
|
||||||
fout << ".a";
|
fout << ".a";
|
||||||
fout << " $(DESTDIR)" << prefix << l->second.GetInstallPath() << "\n";
|
fout << " $(DESTDIR)" << prefix << l->second.GetInstallPath() << "\n";
|
||||||
break;
|
break;
|
||||||
case cmTarget::SHARED_LIBRARY:
|
case cmTarget::SHARED_LIBRARY:
|
||||||
fout << "\t$(INSTALL_DATA) " << m_LibraryOutputPath << "lib"
|
fout << "\t$(INSTALL_DATA) " << m_LibraryOutputPath << "lib"
|
||||||
<< l->first;
|
<< l->first;
|
||||||
fout << m_Makefile->GetDefinition("CMAKE_SHLIB_SUFFIX");
|
fout << m_Makefile->GetDefinition("CMAKE_SHLIB_SUFFIX");
|
||||||
fout << " $(DESTDIR)" << prefix << l->second.GetInstallPath() << "\n";
|
fout << " $(DESTDIR)" << prefix << l->second.GetInstallPath() << "\n";
|
||||||
break;
|
break;
|
||||||
case cmTarget::MODULE_LIBRARY:
|
case cmTarget::MODULE_LIBRARY:
|
||||||
fout << "\t$(INSTALL_DATA) " << m_LibraryOutputPath << "lib"
|
fout << "\t$(INSTALL_DATA) " << m_LibraryOutputPath << "lib"
|
||||||
<< l->first;
|
<< l->first;
|
||||||
fout << m_Makefile->GetDefinition("CMAKE_MODULE_SUFFIX");
|
fout << m_Makefile->GetDefinition("CMAKE_MODULE_SUFFIX");
|
||||||
fout << " $(DESTDIR)" << prefix << l->second.GetInstallPath() << "\n";
|
fout << " $(DESTDIR)" << prefix << l->second.GetInstallPath() << "\n";
|
||||||
break;
|
break;
|
||||||
case cmTarget::WIN32_EXECUTABLE:
|
case cmTarget::WIN32_EXECUTABLE:
|
||||||
case cmTarget::EXECUTABLE:
|
case cmTarget::EXECUTABLE:
|
||||||
fout << "\t$(INSTALL_PROGRAM) " << m_ExecutableOutputPath
|
fout << "\t$(INSTALL_PROGRAM) " << m_ExecutableOutputPath
|
||||||
<< l->first
|
<< l->first
|
||||||
<< cmSystemTools::GetExecutableExtension()
|
<< cmSystemTools::GetExecutableExtension()
|
||||||
<< " $(DESTDIR)" << prefix << l->second.GetInstallPath() << "\n";
|
<< " $(DESTDIR)" << prefix << l->second.GetInstallPath() << "\n";
|
||||||
break;
|
break;
|
||||||
case cmTarget::INSTALL_FILES:
|
case cmTarget::INSTALL_FILES:
|
||||||
{
|
{
|
||||||
std::string sourcePath = m_Makefile->GetCurrentDirectory();
|
std::string sourcePath = m_Makefile->GetCurrentDirectory();
|
||||||
std::string binaryPath = m_Makefile->GetCurrentOutputDirectory();
|
std::string binaryPath = m_Makefile->GetCurrentOutputDirectory();
|
||||||
sourcePath += "/";
|
sourcePath += "/";
|
||||||
binaryPath += "/";
|
binaryPath += "/";
|
||||||
const std::vector<std::string> &sf = l->second.GetSourceLists();
|
const std::vector<std::string> &sf = l->second.GetSourceLists();
|
||||||
std::vector<std::string>::const_iterator i;
|
std::vector<std::string>::const_iterator i;
|
||||||
for (i = sf.begin(); i != sf.end(); ++i)
|
for (i = sf.begin(); i != sf.end(); ++i)
|
||||||
{
|
{
|
||||||
std::string f = *i;
|
std::string f = *i;
|
||||||
if(f.substr(0, sourcePath.length()) == sourcePath)
|
if(f.substr(0, sourcePath.length()) == sourcePath)
|
||||||
{
|
{
|
||||||
@ -1678,7 +1678,7 @@ void cmLocalUnixMakefileGenerator::OutputInstallRules(std::ostream& fout)
|
|||||||
{
|
{
|
||||||
f = f.substr(binaryPath.length());
|
f = f.substr(binaryPath.length());
|
||||||
}
|
}
|
||||||
fout << "\t@echo \"Installing " << f.c_str() << " \"\n";
|
fout << "\t@echo \"Installing " << f.c_str() << " \"\n";
|
||||||
// avoid using install-sh to install install-sh
|
// avoid using install-sh to install install-sh
|
||||||
// does not work on windows....
|
// does not work on windows....
|
||||||
if(*i == "install-sh")
|
if(*i == "install-sh")
|
||||||
@ -1689,21 +1689,21 @@ void cmLocalUnixMakefileGenerator::OutputInstallRules(std::ostream& fout)
|
|||||||
{
|
{
|
||||||
fout << "\t @$(INSTALL_DATA) ";
|
fout << "\t @$(INSTALL_DATA) ";
|
||||||
}
|
}
|
||||||
fout << *i
|
fout << *i
|
||||||
<< " $(DESTDIR)" << prefix << l->second.GetInstallPath() << "\n";
|
<< " $(DESTDIR)" << prefix << l->second.GetInstallPath() << "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case cmTarget::INSTALL_PROGRAMS:
|
case cmTarget::INSTALL_PROGRAMS:
|
||||||
{
|
{
|
||||||
std::string sourcePath = m_Makefile->GetCurrentDirectory();
|
std::string sourcePath = m_Makefile->GetCurrentDirectory();
|
||||||
std::string binaryPath = m_Makefile->GetCurrentOutputDirectory();
|
std::string binaryPath = m_Makefile->GetCurrentOutputDirectory();
|
||||||
sourcePath += "/";
|
sourcePath += "/";
|
||||||
binaryPath += "/";
|
binaryPath += "/";
|
||||||
const std::vector<std::string> &sf = l->second.GetSourceLists();
|
const std::vector<std::string> &sf = l->second.GetSourceLists();
|
||||||
std::vector<std::string>::const_iterator i;
|
std::vector<std::string>::const_iterator i;
|
||||||
for (i = sf.begin(); i != sf.end(); ++i)
|
for (i = sf.begin(); i != sf.end(); ++i)
|
||||||
{
|
{
|
||||||
std::string f = *i;
|
std::string f = *i;
|
||||||
if(f.substr(0, sourcePath.length()) == sourcePath)
|
if(f.substr(0, sourcePath.length()) == sourcePath)
|
||||||
{
|
{
|
||||||
@ -1713,7 +1713,7 @@ void cmLocalUnixMakefileGenerator::OutputInstallRules(std::ostream& fout)
|
|||||||
{
|
{
|
||||||
f = f.substr(binaryPath.length());
|
f = f.substr(binaryPath.length());
|
||||||
}
|
}
|
||||||
fout << "\t@echo \"Installing " << f.c_str() << " \"\n";
|
fout << "\t@echo \"Installing " << f.c_str() << " \"\n";
|
||||||
// avoid using install-sh to install install-sh
|
// avoid using install-sh to install install-sh
|
||||||
// does not work on windows....
|
// does not work on windows....
|
||||||
if(*i == "install-sh")
|
if(*i == "install-sh")
|
||||||
@ -1724,15 +1724,15 @@ void cmLocalUnixMakefileGenerator::OutputInstallRules(std::ostream& fout)
|
|||||||
{
|
{
|
||||||
fout << "\t @$(INSTALL_PROGRAM) ";
|
fout << "\t @$(INSTALL_PROGRAM) ";
|
||||||
}
|
}
|
||||||
fout << *i
|
fout << *i
|
||||||
<< " $(DESTDIR)" << prefix << l->second.GetInstallPath() << "\n";
|
<< " $(DESTDIR)" << prefix << l->second.GetInstallPath() << "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case cmTarget::UTILITY:
|
case cmTarget::UTILITY:
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1941,7 +1941,7 @@ void cmLocalUnixMakefileGenerator::OutputSourceObjectBuildRules(std::ostream& fo
|
|||||||
target != targets.end(); ++target)
|
target != targets.end(); ++target)
|
||||||
{
|
{
|
||||||
bool shared = ((target->second.GetType() == cmTarget::SHARED_LIBRARY) ||
|
bool shared = ((target->second.GetType() == cmTarget::SHARED_LIBRARY) ||
|
||||||
(target->second.GetType() == cmTarget::MODULE_LIBRARY));
|
(target->second.GetType() == cmTarget::MODULE_LIBRARY));
|
||||||
std::string exportsDef = "";
|
std::string exportsDef = "";
|
||||||
if(shared)
|
if(shared)
|
||||||
{
|
{
|
||||||
@ -2060,14 +2060,14 @@ void cmLocalUnixMakefileGenerator::OutputMakeRule(std::ostream& fout,
|
|||||||
// for nmake and borland, the echo should not be quoted
|
// for nmake and borland, the echo should not be quoted
|
||||||
if(strcmp(m_GlobalGenerator->GetName(), "Unix Makefiles") == 0)
|
if(strcmp(m_GlobalGenerator->GetName(), "Unix Makefiles") == 0)
|
||||||
{
|
{
|
||||||
cmSystemTools::ReplaceString(echostring, "\\\n", " ");
|
cmSystemTools::ReplaceString(echostring, "\\\n", " ");
|
||||||
cmSystemTools::ReplaceString(echostring, " \t", " ");
|
cmSystemTools::ReplaceString(echostring, " \t", " ");
|
||||||
cmSystemTools::ReplaceString(echostring, "\n\t", "\"\n\techo \"");
|
cmSystemTools::ReplaceString(echostring, "\n\t", "\"\n\techo \"");
|
||||||
fout << "\techo \"" << echostring.c_str() << "\"\n";
|
fout << "\techo \"" << echostring.c_str() << "\"\n";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
cmSystemTools::ReplaceString(echostring, "\n\t", "\n\techo ");
|
cmSystemTools::ReplaceString(echostring, "\n\t", "\n\techo ");
|
||||||
fout << "\techo " << echostring.c_str() << "\n";
|
fout << "\techo " << echostring.c_str() << "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -162,65 +162,76 @@ struct cmStdString : public std::string
|
|||||||
StdString(s, pos, n) {}
|
StdString(s, pos, n) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Define cmStringStream wrapper to hide differences between
|
// Define cmOStringStream and cmIStringStream wrappers to hide
|
||||||
// std::stringstream and the old strstream.
|
// differences between std::stringstream and the old strstream.
|
||||||
#if !defined(CMAKE_NO_ANSI_STRING_STREAM)
|
#if !defined(CMAKE_NO_ANSI_STRING_STREAM)
|
||||||
class cmStringStream: public std::ostringstream
|
class cmOStringStream: public std::ostringstream
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
cmStringStream() {}
|
cmOStringStream() {}
|
||||||
private:
|
private:
|
||||||
cmStringStream(const cmStringStream&);
|
cmOStringStream(const cmOStringStream&);
|
||||||
void operator=(const cmStringStream&);
|
void operator=(const cmOStringStream&);
|
||||||
};
|
};
|
||||||
class cmInputStringStream: public std::istringstream
|
class cmIStringStream: public std::istringstream
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef std::istringstream Superclass;
|
typedef std::istringstream Superclass;
|
||||||
cmInputStringStream() {}
|
cmIStringStream() {}
|
||||||
cmInputStringStream(const char* c) : Superclass(c) {}
|
cmIStringStream(const std::string& s): Superclass(s) {}
|
||||||
private:
|
private:
|
||||||
cmInputStringStream(const cmInputStringStream&);
|
cmIStringStream(const cmIStringStream&);
|
||||||
void operator=(const cmInputStringStream&);
|
void operator=(const cmIStringStream&);
|
||||||
};
|
};
|
||||||
#else
|
#else
|
||||||
class cmStrStreamCleanup
|
class cmOStrStreamCleanup
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
cmStrStreamCleanup(std::ostrstream& ostr): m_StrStream(ostr) {}
|
cmOStrStreamCleanup(std::ostrstream& ostr): m_OStrStream(ostr) {}
|
||||||
~cmStrStreamCleanup() { m_StrStream.rdbuf()->freeze(0); }
|
~cmOStrStreamCleanup() { m_OStrStream.rdbuf()->freeze(0); }
|
||||||
static void IgnoreUnusedVariable(const cmStrStreamCleanup&) {}
|
static void IgnoreUnusedVariable(const cmOStrStreamCleanup&) {}
|
||||||
protected:
|
protected:
|
||||||
std::ostrstream& m_StrStream;
|
std::ostrstream& m_OStrStream;
|
||||||
};
|
};
|
||||||
|
|
||||||
class cmStringStream: public std::ostrstream
|
class cmOStringStream: public std::ostrstream
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef std::ostrstream Superclass;
|
typedef std::ostrstream Superclass;
|
||||||
cmStringStream() {}
|
cmOStringStream() {}
|
||||||
std::string str()
|
std::string str()
|
||||||
{
|
{
|
||||||
cmStrStreamCleanup cleanup(*this);
|
cmOStrStreamCleanup cleanup(*this);
|
||||||
cmStrStreamCleanup::IgnoreUnusedVariable(cleanup);
|
cmOStrStreamCleanup::IgnoreUnusedVariable(cleanup);
|
||||||
int pcount = this->pcount();
|
int pcount = this->pcount();
|
||||||
const char* ptr = this->Superclass::str();
|
const char* ptr = this->Superclass::str();
|
||||||
return std::string(ptr?ptr:"", pcount);
|
return std::string(ptr?ptr:"", pcount);
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
cmStringStream(const cmStringStream&);
|
cmOStringStream(const cmOStringStream&);
|
||||||
void operator=(const cmStringStream&);
|
void operator=(const cmOStringStream&);
|
||||||
};
|
};
|
||||||
class cmInputStringStream: public std::istrstream
|
|
||||||
|
class cmIStringStream: private std::string, public std::istrstream
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef std::istrstream Superclass;
|
typedef std::string StdString;
|
||||||
cmInputStringStream(const char* c) : Superclass(c) {}
|
typedef std::istrstream IStrStream;
|
||||||
|
cmIStringStream(): StdString(), IStrStream(this->StdString::c_str()) {}
|
||||||
|
cmIStringStream(const std::string& s):
|
||||||
|
StdString(s), IStrStream(this->StdString::c_str()) {}
|
||||||
|
std::string str() const { return *this; }
|
||||||
|
void str(const std::string& s)
|
||||||
|
{
|
||||||
|
// Very dangerous. If this throws, the object is hosed. When the
|
||||||
|
// destructor is later called, the program is hosed too.
|
||||||
|
this->~cmIStringStream();
|
||||||
|
new (this) cmIStringStream(s);
|
||||||
|
}
|
||||||
private:
|
private:
|
||||||
cmInputStringStream(const cmInputStringStream&);
|
cmIStringStream(const cmIStringStream&);
|
||||||
void operator=(const cmInputStringStream&);
|
void operator=(const cmIStringStream&);
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -1083,7 +1083,7 @@ bool cmSystemTools::FilesDiffer(const char* source,
|
|||||||
if(statSource.st_size != static_cast<long>(finSource.gcount()) ||
|
if(statSource.st_size != static_cast<long>(finSource.gcount()) ||
|
||||||
statSource.st_size != static_cast<long>(finDestination.gcount()))
|
statSource.st_size != static_cast<long>(finDestination.gcount()))
|
||||||
{
|
{
|
||||||
cmStringStream msg;
|
cmOStringStream msg;
|
||||||
msg << "FilesDiffer failed to read files (allocated: "
|
msg << "FilesDiffer failed to read files (allocated: "
|
||||||
<< statSource.st_size << ", read source: " << finSource.gcount()
|
<< statSource.st_size << ", read source: " << finSource.gcount()
|
||||||
<< ", read dest: " << finDestination.gcount();
|
<< ", read dest: " << finDestination.gcount();
|
||||||
@ -1190,7 +1190,7 @@ void cmSystemTools::cmCopyFile(const char* source,
|
|||||||
|
|
||||||
if (statSource.st_size != statDestination.st_size)
|
if (statSource.st_size != statDestination.st_size)
|
||||||
{
|
{
|
||||||
cmStringStream msg;
|
cmOStringStream msg;
|
||||||
msg << "CopyFile failed to copy files (sizes differ, source: "
|
msg << "CopyFile failed to copy files (sizes differ, source: "
|
||||||
<< statSource.st_size << " , dest: " << statDestination.st_size;
|
<< statSource.st_size << " , dest: " << statDestination.st_size;
|
||||||
cmSystemTools::Error(msg.str().c_str());
|
cmSystemTools::Error(msg.str().c_str());
|
||||||
@ -1426,7 +1426,7 @@ bool RunCommandViaPopen(const char* command,
|
|||||||
if (WIFSIGNALED(retVal))
|
if (WIFSIGNALED(retVal))
|
||||||
{
|
{
|
||||||
retVal = WTERMSIG(retVal);
|
retVal = WTERMSIG(retVal);
|
||||||
cmStringStream error;
|
cmOStringStream error;
|
||||||
error << "\nProcess terminated due to ";
|
error << "\nProcess terminated due to ";
|
||||||
switch (retVal)
|
switch (retVal)
|
||||||
{
|
{
|
||||||
|
@ -326,7 +326,7 @@ cmVTKMakeInstantiatorCommand
|
|||||||
std::string
|
std::string
|
||||||
cmVTKMakeInstantiatorCommand::OldGenerateCreationFileName(unsigned int block)
|
cmVTKMakeInstantiatorCommand::OldGenerateCreationFileName(unsigned int block)
|
||||||
{
|
{
|
||||||
cmStringStream nameStr;
|
cmOStringStream nameStr;
|
||||||
nameStr << m_ClassName.c_str() << block << ".cxx";
|
nameStr << m_ClassName.c_str() << block << ".cxx";
|
||||||
std::string result = nameStr.str();
|
std::string result = nameStr.str();
|
||||||
return result;
|
return result;
|
||||||
|
@ -95,7 +95,7 @@ void cmake::AddCommand(cmCommand* wg)
|
|||||||
|
|
||||||
void cmake::Usage(const char* program)
|
void cmake::Usage(const char* program)
|
||||||
{
|
{
|
||||||
cmStringStream errorStream;
|
cmOStringStream errorStream;
|
||||||
|
|
||||||
errorStream << "cmake version " << cmMakefile::GetMajorVersion()
|
errorStream << "cmake version " << cmMakefile::GetMajorVersion()
|
||||||
<< "." << cmMakefile::GetMinorVersion() << "\n";
|
<< "." << cmMakefile::GetMinorVersion() << "\n";
|
||||||
@ -332,7 +332,7 @@ int cmake::AddCMakePaths(const char *arg0)
|
|||||||
if(!cmSystemTools::FileExists(cMakeSelf.c_str()))
|
if(!cmSystemTools::FileExists(cMakeSelf.c_str()))
|
||||||
{
|
{
|
||||||
failures.push_back(cMakeSelf);
|
failures.push_back(cMakeSelf);
|
||||||
cmStringStream msg;
|
cmOStringStream msg;
|
||||||
msg << "CMAKE can not find the command line program cmake.\n";
|
msg << "CMAKE can not find the command line program cmake.\n";
|
||||||
msg << " argv[0] = \"" << arg0 << "\"\n";
|
msg << " argv[0] = \"" << arg0 << "\"\n";
|
||||||
msg << " Attempted paths:\n";
|
msg << " Attempted paths:\n";
|
||||||
@ -444,7 +444,7 @@ int cmake::AddCMakePaths(const char *arg0)
|
|||||||
|
|
||||||
void CMakeCommandUsage(const char* program)
|
void CMakeCommandUsage(const char* program)
|
||||||
{
|
{
|
||||||
cmStringStream errorStream;
|
cmOStringStream errorStream;
|
||||||
|
|
||||||
errorStream
|
errorStream
|
||||||
<< "cmake version " << cmMakefile::GetMajorVersion()
|
<< "cmake version " << cmMakefile::GetMajorVersion()
|
||||||
|
@ -475,7 +475,7 @@ int ctest::BuildDirectory()
|
|||||||
// 1 - error
|
// 1 - error
|
||||||
// > 1 - warning
|
// > 1 - warning
|
||||||
std::vector<int> markedLines;
|
std::vector<int> markedLines;
|
||||||
cmInputStringStream istr(coutput);
|
cmIStringStream istr(coutput);
|
||||||
while(istr)
|
while(istr)
|
||||||
{
|
{
|
||||||
char buffer[1024];
|
char buffer[1024];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user