summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2015-02-12 19:53:43 (GMT)
committerStephen Kelly <steveire@gmail.com>2015-02-20 20:26:18 (GMT)
commita281809384cc19cc9a7d1726b243020b380b9395 (patch)
tree6fdf2de4e88230d0425acf06a8b459b0177ef978 /Source
parent76207b0861478318115d65c2e983f4d88c937724 (diff)
downloadCMake-a281809384cc19cc9a7d1726b243020b380b9395.zip
CMake-a281809384cc19cc9a7d1726b243020b380b9395.tar.gz
CMake-a281809384cc19cc9a7d1726b243020b380b9395.tar.bz2
Use cmJoin where possible.
Diffstat (limited to 'Source')
-rw-r--r--Source/cmCoreTryCompile.cxx15
-rw-r--r--Source/cmFindBase.cxx13
-rw-r--r--Source/cmLocalUnixMakefileGenerator3.cxx8
-rw-r--r--Source/cmcmd.cxx24
4 files changed, 9 insertions, 51 deletions
diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx
index 8e20c14..bcd2d81 100644
--- a/Source/cmCoreTryCompile.cxx
+++ b/Source/cmCoreTryCompile.cxx
@@ -260,14 +260,10 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
err << "Unknown extension \"" << ext << "\" for file\n"
<< " " << *si << "\n"
<< "try_compile() works only for enabled languages. "
- << "Currently these are:\n ";
+ << "Currently these are:\n ";
std::vector<std::string> langs;
gg->GetEnabledLanguages(langs);
- for(std::vector<std::string>::iterator l = langs.begin();
- l != langs.end(); ++l)
- {
- err << " " << *l;
- }
+ err << cmJoin(langs, " ");
err << "\nSee project() command to enable other languages.";
this->Makefile->IssueMessage(cmake::FATAL_ERROR, err.str());
return -1;
@@ -373,12 +369,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
// handle any compile flags we need to pass on
if (!compileDefs.empty())
{
- fprintf(fout, "add_definitions( ");
- for (size_t i = 0; i < compileDefs.size(); ++i)
- {
- fprintf(fout,"%s ",compileDefs[i].c_str());
- }
- fprintf(fout, ")\n");
+ fprintf(fout, "add_definitions(%s)\n", cmJoin(compileDefs, " ").c_str());
}
/* Use a random file name to avoid rapid creation and deletion
diff --git a/Source/cmFindBase.cxx b/Source/cmFindBase.cxx
index 6e55533..fd3aa0b 100644
--- a/Source/cmFindBase.cxx
+++ b/Source/cmFindBase.cxx
@@ -350,19 +350,10 @@ void cmFindBase::PrintFindStuff()
std::cerr << "NoCMakeSystemPath " << this->NoCMakeSystemPath << "\n";
std::cerr << "EnvironmentPath " << this->EnvironmentPath << "\n";
std::cerr << "CMakePathName " << this->CMakePathName << "\n";
- std::cerr << "Names ";
- for(unsigned int i =0; i < this->Names.size(); ++i)
- {
- std::cerr << this->Names[i] << " ";
- }
- std::cerr << "\n";
+ std::cerr << "Names " << cmJoin(this->Names, " ") << "\n";
std::cerr << "\n";
std::cerr << "SearchPathSuffixes ";
- for(unsigned int i =0; i < this->SearchPathSuffixes.size(); ++i)
- {
- std::cerr << this->SearchPathSuffixes[i] << "\n";
- }
- std::cerr << "\n";
+ std::cerr << cmJoin(this->SearchPathSuffixes, "\n") << "\n";
std::cerr << "SearchPaths\n";
for(std::vector<std::string>::const_iterator i = this->SearchPaths.begin();
i != this->SearchPaths.end(); ++i)
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index c275e6b..68657ad 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -1330,13 +1330,7 @@ cmLocalUnixMakefileGenerator3
this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"));
fout << "\n"
<< "# Per-language clean rules from dependency scanning.\n"
- << "foreach(lang";
- for(std::set<std::string>::const_iterator l = languages.begin();
- l != languages.end(); ++l)
- {
- fout << " " << *l;
- }
- fout << ")\n"
+ << "foreach(lang " << cmJoin(languages, " ") << ")\n"
<< " include(" << this->GetTargetDirectory(target)
<< "/cmake_clean_${lang}.cmake OPTIONAL)\n"
<< "endforeach()\n";
diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx
index 6a7dc6e..eb637ef 100644
--- a/Source/cmcmd.cxx
+++ b/Source/cmcmd.cxx
@@ -213,27 +213,14 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
// Echo string
else if (args[1] == "echo" )
{
- unsigned int cc;
- const char* space = "";
- for ( cc = 2; cc < args.size(); cc ++ )
- {
- std::cout << space << args[cc];
- space = " ";
- }
- std::cout << std::endl;
+ std::cout << cmJoin(cmRange(args).advance(2), " ") << std::endl;
return 0;
}
// Echo string no new line
else if (args[1] == "echo_append" )
{
- unsigned int cc;
- const char* space = "";
- for ( cc = 2; cc < args.size(); cc ++ )
- {
- std::cout << space << args[cc];
- space = " ";
- }
+ std::cout << cmJoin(cmRange(args).advance(2), " ");
return 0;
}
@@ -1329,12 +1316,7 @@ bool cmcmd::RunCommand(const char* comment,
if(verbose)
{
std::cout << comment << ":\n";
- for(std::vector<std::string>::iterator i = command.begin();
- i != command.end(); ++i)
- {
- std::cout << *i << " ";
- }
- std::cout << "\n";
+ std::cout << cmJoin(command, " ") << "\n";
}
std::string output;
int retCode =0;