summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/CMakeLists.txt1
-rw-r--r--Source/CMakeVersion.cmake2
-rw-r--r--Source/CPack/OSXScriptLauncher.cxx8
-rw-r--r--Source/CPack/cmCPackNSISGenerator.cxx2
-rw-r--r--Source/CPack/cpack.cxx2
-rw-r--r--Source/CTest/cmCTestCoverageHandler.cxx4
-rw-r--r--Source/CursesDialog/ccmake.cxx3
-rw-r--r--Source/QtDialog/CMakeSetup.cxx6
-rw-r--r--Source/cmAddLibraryCommand.cxx6
-rw-r--r--Source/cmArchiveWrite.cxx4
-rw-r--r--Source/cmCPluginAPI.cxx7
-rw-r--r--Source/cmComputeLinkDepends.cxx7
-rw-r--r--Source/cmCoreTryCompile.cxx2
-rw-r--r--Source/cmFLTKWrapUICommand.cxx7
-rw-r--r--Source/cmFileCommand.cxx4
-rw-r--r--Source/cmFindLibraryCommand.cxx4
-rw-r--r--Source/cmGlobalUnixMakefileGenerator3.cxx43
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx155
-rw-r--r--Source/cmInstallFilesCommand.cxx7
-rw-r--r--Source/cmLocalGenerator.cxx33
-rw-r--r--Source/cmLocalUnixMakefileGenerator3.cxx49
-rw-r--r--Source/cmLocalUnixMakefileGenerator3.h5
-rw-r--r--Source/cmLocale.h31
-rw-r--r--Source/cmMakefile.cxx13
-rw-r--r--Source/cmMakefile.h11
-rw-r--r--Source/cmMakefileExecutableTargetGenerator.cxx6
-rw-r--r--Source/cmMakefileLibraryTargetGenerator.cxx6
-rw-r--r--Source/cmMakefileTargetGenerator.cxx36
-rw-r--r--Source/cmMakefileTargetGenerator.h2
-rw-r--r--Source/cmQTWrapCPPCommand.cxx10
-rw-r--r--Source/cmQTWrapUICommand.cxx10
-rw-r--r--Source/cmSetTargetPropertiesCommand.cxx15
-rw-r--r--Source/cmSetTestsPropertiesCommand.cxx15
-rw-r--r--Source/cmSystemTools.cxx27
-rw-r--r--Source/cmSystemTools.h2
-rw-r--r--Source/cmTarget.cxx13
-rw-r--r--Source/cmXMLSafe.cxx4
-rw-r--r--Source/cmXMLSafe.h4
-rw-r--r--Source/cmake.cxx9
-rw-r--r--Source/cmakemain.cxx2
-rw-r--r--Source/cmcmd.cxx128
-rw-r--r--Source/ctest.cxx3
42 files changed, 351 insertions, 357 deletions
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt
index 07839f3..8a83c3e 100644
--- a/Source/CMakeLists.txt
+++ b/Source/CMakeLists.txt
@@ -277,6 +277,7 @@ set(SRCS
cmLocalGenerator.cxx
cmLocalGenerator.h
cmLocalUnixMakefileGenerator3.cxx
+ cmLocale.h
${MACH_SRCS}
cmMakeDepend.cxx
cmMakeDepend.h
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index a7d6c4b..03df29d 100644
--- a/Source/CMakeVersion.cmake
+++ b/Source/CMakeVersion.cmake
@@ -1,5 +1,5 @@
# CMake version number components.
set(CMake_VERSION_MAJOR 3)
set(CMake_VERSION_MINOR 2)
-set(CMake_VERSION_PATCH 20150205)
+set(CMake_VERSION_PATCH 20150210)
#set(CMake_VERSION_RC 1)
diff --git a/Source/CPack/OSXScriptLauncher.cxx b/Source/CPack/OSXScriptLauncher.cxx
index d9d6236..1d7afbd 100644
--- a/Source/CPack/OSXScriptLauncher.cxx
+++ b/Source/CPack/OSXScriptLauncher.cxx
@@ -26,7 +26,7 @@
int main(int argc, char* argv[])
{
//if ( cmsys::SystemTools::FileExists(
- cmsys_stl::string cwd = cmsys::SystemTools::GetCurrentWorkingDirectory();
+ std::string cwd = cmsys::SystemTools::GetCurrentWorkingDirectory();
cmsys::ofstream ofs("/tmp/output.txt");
CFStringRef fileName;
@@ -66,7 +66,7 @@ int main(int argc, char* argv[])
//dispose of the CF variable
CFRelease(scriptFileURL);
- cmsys_stl::string fullScriptPath = reinterpret_cast<char*>(path);
+ std::string fullScriptPath = reinterpret_cast<char*>(path);
delete [] path;
@@ -75,10 +75,10 @@ int main(int argc, char* argv[])
return 1;
}
- cmsys_stl::string scriptDirectory = cmsys::SystemTools::GetFilenamePath(
+ std::string scriptDirectory = cmsys::SystemTools::GetFilenamePath(
fullScriptPath);
ofs << fullScriptPath.c_str() << cmsys_ios::endl;
- cmsys_stl::vector<const char*> args;
+ std::vector<const char*> args;
args.push_back(fullScriptPath.c_str());
int cc;
for ( cc = 1; cc < argc; ++ cc )
diff --git a/Source/CPack/cmCPackNSISGenerator.cxx b/Source/CPack/cmCPackNSISGenerator.cxx
index 8f63ca2..fe6cc95 100644
--- a/Source/CPack/cmCPackNSISGenerator.cxx
+++ b/Source/CPack/cmCPackNSISGenerator.cxx
@@ -654,7 +654,7 @@ bool cmCPackNSISGenerator::GetListOfSubdirectories(const char* topdir,
if (strcmp(dir.GetFile(static_cast<unsigned long>(fileNum)),".") &&
strcmp(dir.GetFile(static_cast<unsigned long>(fileNum)),".."))
{
- cmsys_stl::string fullPath = topdir;
+ std::string fullPath = topdir;
fullPath += "/";
fullPath += dir.GetFile(static_cast<unsigned long>(fileNum));
if(cmsys::SystemTools::FileIsDirectory(fullPath) &&
diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx
index 00bfe5b..6106472 100644
--- a/Source/CPack/cpack.cxx
+++ b/Source/CPack/cpack.cxx
@@ -26,7 +26,6 @@
#include <cmsys/CommandLineArguments.hxx>
#include <cmsys/SystemTools.hxx>
#include <cmsys/Encoding.hxx>
-#include <locale.h>
//----------------------------------------------------------------------------
static const char * cmDocumentationName[][2] =
@@ -101,7 +100,6 @@ int cpackDefinitionArgument(const char* argument, const char* cValue,
// this is CPack.
int main (int argc, char const* const* argv)
{
- setlocale(LC_CTYPE, "");
cmsys::Encoding::CommandLineArguments args =
cmsys::Encoding::CommandLineArguments::Main(argc, argv);
argc = args.argc();
diff --git a/Source/CTest/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx
index 08b7c66..1226d22 100644
--- a/Source/CTest/cmCTestCoverageHandler.cxx
+++ b/Source/CTest/cmCTestCoverageHandler.cxx
@@ -2542,10 +2542,10 @@ bool cmCTestCoverageHandler::IntersectsFilter(LabelSet const& labels)
}
std::vector<int> ids;
- cmsys_stl::set_intersection
+ std::set_intersection
(labels.begin(), labels.end(),
this->LabelFilter.begin(), this->LabelFilter.end(),
- cmsys_stl::back_inserter(ids));
+ std::back_inserter(ids));
return !ids.empty();
}
diff --git a/Source/CursesDialog/ccmake.cxx b/Source/CursesDialog/ccmake.cxx
index 28f3d9b..3d92a2d 100644
--- a/Source/CursesDialog/ccmake.cxx
+++ b/Source/CursesDialog/ccmake.cxx
@@ -16,7 +16,6 @@
#include <signal.h>
#include <sys/ioctl.h>
-#include <locale.h>
#include "cmCursesMainForm.h"
#include "cmCursesStandardIncludes.h"
@@ -95,8 +94,6 @@ void CMakeMessageHandler(const char* message, const char* title, bool&,
int main(int argc, char const* const* argv)
{
- setlocale(LC_CTYPE, "");
-
cmsys::Encoding::CommandLineArguments encoding_args =
cmsys::Encoding::CommandLineArguments::Main(argc, argv);
argc = encoding_args.argc();
diff --git a/Source/QtDialog/CMakeSetup.cxx b/Source/QtDialog/CMakeSetup.cxx
index 82fa3a3..8a72a24 100644
--- a/Source/QtDialog/CMakeSetup.cxx
+++ b/Source/QtDialog/CMakeSetup.cxx
@@ -149,10 +149,10 @@ int main(int argc, char** argv)
QStringList args = app.arguments();
if(args.count() == 2)
{
- cmsys_stl::string filePath = cmSystemTools::CollapseFullPath(args[1].toLocal8Bit().data());
+ std::string filePath = cmSystemTools::CollapseFullPath(args[1].toLocal8Bit().data());
// check if argument is a directory containing CMakeCache.txt
- cmsys_stl::string buildFilePath =
+ std::string buildFilePath =
cmSystemTools::CollapseFullPath("CMakeCache.txt", filePath.c_str());
// check if argument is a CMakeCache.txt file
@@ -163,7 +163,7 @@ int main(int argc, char** argv)
}
// check if argument is a directory containing CMakeLists.txt
- cmsys_stl::string srcFilePath =
+ std::string srcFilePath =
cmSystemTools::CollapseFullPath("CMakeLists.txt", filePath.c_str());
if(cmSystemTools::FileExists(buildFilePath.c_str()))
diff --git a/Source/cmAddLibraryCommand.cxx b/Source/cmAddLibraryCommand.cxx
index db2f6fb..edf82bd 100644
--- a/Source/cmAddLibraryCommand.cxx
+++ b/Source/cmAddLibraryCommand.cxx
@@ -435,11 +435,7 @@ bool cmAddLibraryCommand
cmSystemTools::Message(msg.c_str() ,"Warning");
}
- while (s != args.end())
- {
- srclists.push_back(*s);
- ++s;
- }
+ srclists.insert(srclists.end(), s, args.end());
this->Makefile->AddLibrary(libName, type, srclists, excludeFromAll);
diff --git a/Source/cmArchiveWrite.cxx b/Source/cmArchiveWrite.cxx
index c24c68e..cf2fe82 100644
--- a/Source/cmArchiveWrite.cxx
+++ b/Source/cmArchiveWrite.cxx
@@ -12,6 +12,7 @@
#include "cmArchiveWrite.h"
#include "cmSystemTools.h"
+#include "cmLocale.h"
#include <cmsys/ios/iostream>
#include <cmsys/Directory.hxx>
#include <cmsys/FStream.hxx>
@@ -260,6 +261,9 @@ bool cmArchiveWrite::AddFile(const char* file,
}
const char* out = file + skip;
+ cmLocaleRAII localeRAII;
+ static_cast<void>(localeRAII);
+
// Meta-data.
std::string dest = prefix? prefix : "";
dest += out;
diff --git a/Source/cmCPluginAPI.cxx b/Source/cmCPluginAPI.cxx
index d0dc30a..691d80d 100644
--- a/Source/cmCPluginAPI.cxx
+++ b/Source/cmCPluginAPI.cxx
@@ -438,15 +438,14 @@ void CCONV cmExpandSourceListArguments(void *arg,
char ***resArgv,
unsigned int startArgumentIndex)
{
- cmMakefile *mf = static_cast<cmMakefile *>(arg);
+ (void)arg;
+ (void)startArgumentIndex;
std::vector<std::string> result;
- std::vector<std::string> args2;
int i;
for (i = 0; i < numArgs; ++i)
{
- args2.push_back(args[i]);
+ result.push_back(args[i]);
}
- mf->ExpandSourceListArguments(args2, result, startArgumentIndex);
int resargc = static_cast<int>(result.size());
char **resargv = 0;
if (resargc)
diff --git a/Source/cmComputeLinkDepends.cxx b/Source/cmComputeLinkDepends.cxx
index 32d5cd3..8652690 100644
--- a/Source/cmComputeLinkDepends.cxx
+++ b/Source/cmComputeLinkDepends.cxx
@@ -669,7 +669,7 @@ void cmComputeLinkDepends::InferDependencies()
for(++i; i != sets->end(); ++i)
{
DependSet intersection;
- cmsys_stl::set_intersection
+ std::set_intersection
(common.begin(), common.end(), i->begin(), i->end(),
std::inserter(intersection, intersection.begin()));
common = intersection;
@@ -689,11 +689,10 @@ void cmComputeLinkDepends::CleanConstraintGraph()
{
// Sort the outgoing edges for each graph node so that the
// original order will be preserved as much as possible.
- cmsys_stl::sort(i->begin(), i->end());
+ std::sort(i->begin(), i->end());
// Make the edge list unique.
- EdgeList::iterator last = cmsys_stl::unique(i->begin(), i->end());
- i->erase(last, i->end());
+ i->erase(std::unique(i->begin(), i->end()), i->end());
}
}
diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx
index 5b5d6b6..c414553 100644
--- a/Source/cmCoreTryCompile.cxx
+++ b/Source/cmCoreTryCompile.cxx
@@ -296,7 +296,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
cmVersion::GetPatchVersion(), cmVersion::GetTweakVersion());
if(def)
{
- fprintf(fout, "set(CMAKE_MODULE_PATH %s)\n", def);
+ fprintf(fout, "set(CMAKE_MODULE_PATH \"%s\")\n", def);
}
std::string projectLangs;
diff --git a/Source/cmFLTKWrapUICommand.cxx b/Source/cmFLTKWrapUICommand.cxx
index f7d8243..488beaa 100644
--- a/Source/cmFLTKWrapUICommand.cxx
+++ b/Source/cmFLTKWrapUICommand.cxx
@@ -31,9 +31,6 @@ bool cmFLTKWrapUICommand
// get parameter for the command
this->Target = args[0]; // Target that will use the generated files
- std::vector<std::string> newArgs;
- this->Makefile->ExpandSourceListArguments(args,newArgs, 1);
-
// get the list of GUI files from which .cxx and .h will be generated
std::string outputDirectory = this->Makefile->GetCurrentOutputDirectory();
@@ -45,8 +42,8 @@ bool cmFLTKWrapUICommand
this->Makefile->AddIncludeDirectories( outputDirectories );
}
- for(std::vector<std::string>::iterator i = (newArgs.begin() + 1);
- i != newArgs.end(); i++)
+ for(std::vector<std::string>::const_iterator i = (args.begin() + 1);
+ i != args.end(); i++)
{
cmSourceFile *curr = this->Makefile->GetSource(*i);
// if we should use the source GUI
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx
index 579e715..8b893bc 100644
--- a/Source/cmFileCommand.cxx
+++ b/Source/cmFileCommand.cxx
@@ -71,7 +71,7 @@ static std::string fix_file_url_windows(const std::string& url)
std::string ret = url;
if(strncmp(url.c_str(), "file://", 7) == 0)
{
- cmsys_stl::wstring wurl = cmsys::Encoding::ToWide(url);
+ std::wstring wurl = cmsys::Encoding::ToWide(url);
if(!wurl.empty())
{
int mblen = WideCharToMultiByte(CP_ACP, 0, wurl.c_str(), -1,
@@ -1843,7 +1843,7 @@ bool cmFileCopier::InstallDirectory(const char* source,
if(!(strcmp(dir.GetFile(fileNum), ".") == 0 ||
strcmp(dir.GetFile(fileNum), "..") == 0))
{
- cmsys_stl::string fromPath = source;
+ std::string fromPath = source;
fromPath += "/";
fromPath += dir.GetFile(fileNum);
std::string toPath = destination;
diff --git a/Source/cmFindLibraryCommand.cxx b/Source/cmFindLibraryCommand.cxx
index 78f0e9e..c499f61 100644
--- a/Source/cmFindLibraryCommand.cxx
+++ b/Source/cmFindLibraryCommand.cxx
@@ -195,12 +195,12 @@ struct cmFindLibraryHelper
void RegexFromList(std::string& out, std::vector<std::string> const& in);
size_type GetPrefixIndex(std::string const& prefix)
{
- return cmsys_stl::find(this->Prefixes.begin(), this->Prefixes.end(),
+ return std::find(this->Prefixes.begin(), this->Prefixes.end(),
prefix) - this->Prefixes.begin();
}
size_type GetSuffixIndex(std::string const& suffix)
{
- return cmsys_stl::find(this->Suffixes.begin(), this->Suffixes.end(),
+ return std::find(this->Suffixes.begin(), this->Suffixes.end(),
suffix) - this->Suffixes.begin();
}
bool HasValidSuffix(std::string const& name);
diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx
index 5f1bb83..e0ccaa9 100644
--- a/Source/cmGlobalUnixMakefileGenerator3.cxx
+++ b/Source/cmGlobalUnixMakefileGenerator3.cxx
@@ -779,29 +779,24 @@ cmGlobalUnixMakefileGenerator3
localName += "/all";
depends.clear();
- std::string progressDir =
- lg->GetMakefile()->GetHomeOutputDirectory();
- progressDir += cmake::GetCMakeFilesDirectory();
+ cmLocalUnixMakefileGenerator3::EchoProgress progress;
+ progress.Dir = lg->GetMakefile()->GetHomeOutputDirectory();
+ progress.Dir += cmake::GetCMakeFilesDirectory();
+ {
+ std::ostringstream progressArg;
+ const char* sep = "";
+ std::vector<unsigned long>& progFiles =
+ this->ProgressMap[gtarget->Target].Marks;
+ for (std::vector<unsigned long>::iterator i = progFiles.begin();
+ i != progFiles.end(); ++i)
{
- std::ostringstream progCmd;
- progCmd << "$(CMAKE_COMMAND) -E cmake_progress_report ";
- // all target counts
- progCmd << lg->Convert(progressDir,
- cmLocalGenerator::FULL,
- cmLocalGenerator::SHELL);
- progCmd << " ";
- std::vector<unsigned long>& progFiles =
- this->ProgressMap[gtarget->Target].Marks;
- for (std::vector<unsigned long>::iterator i = progFiles.begin();
- i != progFiles.end(); ++i)
- {
- progCmd << " " << *i;
- }
- commands.push_back(progCmd.str());
+ progressArg << sep << *i;
+ sep = ",";
}
- progressDir = "Built target ";
- progressDir += name;
- lg->AppendEcho(commands,progressDir.c_str());
+ progress.Arg = progressArg.str();
+ }
+ lg->AppendEcho(commands, "Built target " + name,
+ cmLocalUnixMakefileGenerator3::EchoNormal, &progress);
this->AppendGlobalTargetDepends(depends,*gtarget->Target);
lg->WriteMakeRule(ruleFileStream, "All Build rule for target.",
@@ -819,15 +814,13 @@ cmGlobalUnixMakefileGenerator3
// Write the rule.
commands.clear();
- progressDir = lg->GetMakefile()->GetHomeOutputDirectory();
- progressDir += cmake::GetCMakeFilesDirectory();
{
// TODO: Convert the total progress count to a make variable.
std::ostringstream progCmd;
progCmd << "$(CMAKE_COMMAND) -E cmake_progress_start ";
// # in target
- progCmd << lg->Convert(progressDir,
+ progCmd << lg->Convert(progress.Dir,
cmLocalGenerator::FULL,
cmLocalGenerator::SHELL);
//
@@ -843,7 +836,7 @@ cmGlobalUnixMakefileGenerator3
{
std::ostringstream progCmd;
progCmd << "$(CMAKE_COMMAND) -E cmake_progress_start "; // # 0
- progCmd << lg->Convert(progressDir,
+ progCmd << lg->Convert(progress.Dir,
cmLocalGenerator::FULL,
cmLocalGenerator::SHELL);
progCmd << " 0";
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index cd0dcc6..30ed134 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -1743,7 +1743,6 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
return;
}
- std::string flags;
std::string defFlags;
bool shared = ((target.GetType() == cmTarget::SHARED_LIBRARY) ||
(target.GetType() == cmTarget::MODULE_LIBRARY));
@@ -1752,19 +1751,15 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
(target.GetType() == cmTarget::EXECUTABLE) ||
shared);
- std::string lang = target.GetLinkerLanguage(configName);
- std::string cflags;
- if(!lang.empty())
+ // Compute the compilation flags for each language.
+ std::set<std::string> languages;
+ target.GetLanguages(languages, configName);
+ std::map<std::string, std::string> cflags;
+ for (std::set<std::string>::iterator li = languages.begin();
+ li != languages.end(); ++li)
{
- // for c++ projects get the c flags as well
- if(lang == "CXX")
- {
- this->CurrentLocalGenerator->AddLanguageFlags(cflags, "C", configName);
- this->CurrentLocalGenerator->AddCMP0018Flags(cflags, &target,
- "C", configName);
- this->CurrentLocalGenerator->
- AddCompileOptions(cflags, &target, "C", configName);
- }
+ std::string const& lang = *li;
+ std::string& flags = cflags[lang];
// Add language-specific flags.
this->CurrentLocalGenerator->AddLanguageFlags(flags, lang, configName);
@@ -1779,13 +1774,15 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
this->CurrentLocalGenerator->
AddCompileOptions(flags, &target, lang, configName);
}
- else if(binary)
- {
+
+ std::string llang = target.GetLinkerLanguage(configName);
+ if(binary && llang.empty())
+ {
cmSystemTools::Error
("CMake can not determine linker language for target: ",
target.GetName().c_str());
return;
- }
+ }
// Add define flags
this->CurrentLocalGenerator->
@@ -2004,7 +2001,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
// in many ways as an application bundle, as far as
// link flags go
std::string createFlags =
- this->LookupFlags("CMAKE_SHARED_MODULE_CREATE_", lang, "_FLAGS",
+ this->LookupFlags("CMAKE_SHARED_MODULE_CREATE_", llang, "_FLAGS",
"-bundle");
if(!createFlags.empty())
{
@@ -2032,7 +2029,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
this->CreateString("NO"));
// Add the flags to create an executable.
std::string createFlags =
- this->LookupFlags("CMAKE_", lang, "_LINK_FLAGS", "");
+ this->LookupFlags("CMAKE_", llang, "_LINK_FLAGS", "");
if(!createFlags.empty())
{
extraLinkOptions += " ";
@@ -2043,7 +2040,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
{
// Add the flags to create a module.
std::string createFlags =
- this->LookupFlags("CMAKE_SHARED_MODULE_CREATE_", lang, "_FLAGS",
+ this->LookupFlags("CMAKE_SHARED_MODULE_CREATE_", llang, "_FLAGS",
"-bundle");
if(!createFlags.empty())
{
@@ -2077,7 +2074,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
{
// Add the flags to create a shared library.
std::string createFlags =
- this->LookupFlags("CMAKE_SHARED_LIBRARY_CREATE_", lang, "_FLAGS",
+ this->LookupFlags("CMAKE_SHARED_LIBRARY_CREATE_", llang, "_FLAGS",
"-dynamiclib");
if(!createFlags.empty())
{
@@ -2094,7 +2091,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
{
// Add the flags to create an executable.
std::string createFlags =
- this->LookupFlags("CMAKE_", lang, "_LINK_FLAGS", "");
+ this->LookupFlags("CMAKE_", llang, "_LINK_FLAGS", "");
if(!createFlags.empty())
{
extraLinkOptions += " ";
@@ -2178,53 +2175,58 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
buildSettings->AddAttribute("HEADER_SEARCH_PATHS",
dirs.CreateList());
}
- std::string oflagc = this->ExtractFlag("-O", cflags);
+
+ bool same_gflags = true;
+ std::map<std::string, std::string> gflags;
+ std::string const* last_gflag = 0;
char optLevel[2];
optLevel[0] = '0';
optLevel[1] = 0;
- if(oflagc.size() == 3)
- {
- optLevel[0] = oflagc[2];
- }
- if(oflagc.size() == 2)
- {
- optLevel[0] = '1';
- }
- std::string oflag = this->ExtractFlag("-O", flags);
- if(oflag.size() == 3)
- {
- optLevel[0] = oflag[2];
- }
- if(oflag.size() == 2)
- {
- optLevel[0] = '1';
- }
- std::string gflagc = this->ExtractFlag("-g", cflags);
- // put back gdwarf-2 if used since there is no way
- // to represent it in the gui, but we still want debug yes
- if(gflagc == "-gdwarf-2")
- {
- cflags += " ";
- cflags += gflagc;
- }
- std::string gflag = this->ExtractFlag("-g", flags);
- if(gflag == "-gdwarf-2")
+
+ // Minimal map of flags to build settings.
+ for (std::set<std::string>::iterator li = languages.begin();
+ li != languages.end(); ++li)
{
- flags += " ";
- flags += gflag;
+ std::string& flags = cflags[*li];
+ std::string& gflag = gflags[*li];
+ std::string oflag = this->ExtractFlag("-O", flags);
+ if(oflag.size() == 3)
+ {
+ optLevel[0] = oflag[2];
+ }
+ if(oflag.size() == 2)
+ {
+ optLevel[0] = '1';
+ }
+ gflag = this->ExtractFlag("-g", flags);
+ // put back gdwarf-2 if used since there is no way
+ // to represent it in the gui, but we still want debug yes
+ if(gflag == "-gdwarf-2")
+ {
+ flags += " ";
+ flags += gflag;
+ }
+ if (last_gflag && *last_gflag != gflag)
+ {
+ same_gflags = false;
+ }
+ last_gflag = &gflag;
}
+
const char* debugStr = "YES";
- // We can't set the Xcode flag differently depending on the language,
- // so put them back in this case.
- if( (lang == "CXX") && gflag != gflagc )
+ if (!same_gflags)
{
- cflags += " ";
- cflags += gflagc;
- flags += " ";
- flags += gflag;
+ // We can't set the Xcode flag differently depending on the language,
+ // so put them back in this case.
+ for (std::set<std::string>::iterator li = languages.begin();
+ li != languages.end(); ++li)
+ {
+ cflags[*li] += " ";
+ cflags[*li] += gflags[*li];
+ }
debugStr = "NO";
}
- if( gflag == "-g0" || gflag.size() == 0 )
+ else if (last_gflag && (last_gflag->empty() || *last_gflag == "-g0"))
{
debugStr = "NO";
}
@@ -2239,24 +2241,25 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
this->CreateString("NO"));
buildSettings->AddAttribute("GCC_INLINES_ARE_PRIVATE_EXTERN",
this->CreateString("NO"));
- if(lang == "CXX")
+ for (std::set<std::string>::iterator li = languages.begin();
+ li != languages.end(); ++li)
{
- flags += " ";
- flags += defFlags;
- buildSettings->AddAttribute("OTHER_CPLUSPLUSFLAGS",
- this->CreateString(flags.c_str()));
- cflags += " ";
- cflags += defFlags;
- buildSettings->AddAttribute("OTHER_CFLAGS",
- this->CreateString(cflags.c_str()));
-
- }
- else
- {
- flags += " ";
- flags += defFlags;
- buildSettings->AddAttribute("OTHER_CFLAGS",
- this->CreateString(flags.c_str()));
+ std::string flags = cflags[*li] + " " + defFlags;
+ if (*li == "CXX")
+ {
+ buildSettings->AddAttribute("OTHER_CPLUSPLUSFLAGS",
+ this->CreateString(flags.c_str()));
+ }
+ else if (*li == "Fortran")
+ {
+ buildSettings->AddAttribute("IFORT_OTHER_FLAGS",
+ this->CreateString(flags.c_str()));
+ }
+ else if (*li == "C")
+ {
+ buildSettings->AddAttribute("OTHER_CFLAGS",
+ this->CreateString(flags.c_str()));
+ }
}
// Add Fortran source format attribute if property is set.
diff --git a/Source/cmInstallFilesCommand.cxx b/Source/cmInstallFilesCommand.cxx
index 06a78e5..85e5345 100644
--- a/Source/cmInstallFilesCommand.cxx
+++ b/Source/cmInstallFilesCommand.cxx
@@ -15,9 +15,9 @@
// cmExecutableCommand
bool cmInstallFilesCommand
-::InitialPass(std::vector<std::string> const& argsIn, cmExecutionStatus &)
+::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &)
{
- if(argsIn.size() < 2)
+ if(args.size() < 2)
{
this->SetError("called with incorrect number of arguments");
return false;
@@ -27,9 +27,6 @@ bool cmInstallFilesCommand
this->Makefile->GetLocalGenerator()
->GetGlobalGenerator()->EnableInstallTarget();
- std::vector<std::string> args;
- this->Makefile->ExpandSourceListArguments(argsIn, args, 2);
-
this->Destination = args[0];
if((args.size() > 1) && (args[1] == "FILES"))
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 7ca7684..7afe05f 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -3204,11 +3204,7 @@ cmLocalGenerator
std::string ssin = sin;
// Avoid full paths by removing leading slashes.
- std::string::size_type pos = 0;
- for(;pos < ssin.size() && ssin[pos] == '/'; ++pos)
- {
- }
- ssin = ssin.substr(pos);
+ ssin.erase(0, ssin.find_first_not_of("/"));
// Avoid full paths by removing colons.
cmSystemTools::ReplaceString(ssin, ":", "_");
@@ -3645,26 +3641,21 @@ bool cmLocalGenerator::NeedBackwardsCompatibility_2_4()
bool cmLocalGenerator::CheckDefinition(std::string const& define) const
{
// Many compilers do not support -DNAME(arg)=sdf so we disable it.
- bool function_style = false;
- for(const char* c = define.c_str(); *c && *c != '='; ++c)
+ std::string::size_type pos = define.find_first_of("(=");
+ if (pos != std::string::npos)
{
- if(*c == '(')
+ if (define[pos] == '(')
{
- function_style = true;
- break;
+ std::ostringstream e;
+ e << "WARNING: Function-style preprocessor definitions may not be "
+ << "passed on the compiler command line because many compilers "
+ << "do not support it.\n"
+ << "CMake is dropping a preprocessor definition: " << define << "\n"
+ << "Consider defining the macro in a (configured) header file.\n";
+ cmSystemTools::Message(e.str().c_str());
+ return false;
}
}
- if(function_style)
- {
- std::ostringstream e;
- e << "WARNING: Function-style preprocessor definitions may not be "
- << "passed on the compiler command line because many compilers "
- << "do not support it.\n"
- << "CMake is dropping a preprocessor definition: " << define << "\n"
- << "Consider defining the macro in a (configured) header file.\n";
- cmSystemTools::Message(e.str().c_str());
- return false;
- }
// Many compilers do not support # in the value so we disable it.
if(define.find_first_of("#") != define.npos)
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index fbf2140..54d330f 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -27,10 +27,10 @@
#ifdef CMAKE_BUILD_WITH_CMAKE
# include "cmDependsFortran.h"
# include "cmDependsJava.h"
-# include <cmsys/Terminal.h>
#endif
#include <cmsys/auto_ptr.hxx>
+#include <cmsys/Terminal.h>
#include <queue>
@@ -1346,12 +1346,12 @@ cmLocalUnixMakefileGenerator3
//----------------------------------------------------------------------------
void
cmLocalUnixMakefileGenerator3::AppendEcho(std::vector<std::string>& commands,
- const char* text,
- EchoColor color)
+ std::string const& text,
+ EchoColor color,
+ EchoProgress const* progress)
{
// Choose the color for the text.
std::string color_name;
-#ifdef CMAKE_BUILD_WITH_CMAKE
if(this->GlobalGenerator->GetToolSupportsColor() && this->ColorMakefile)
{
// See cmake::ExecuteEchoColor in cmake.cxx for these options.
@@ -1367,7 +1367,7 @@ cmLocalUnixMakefileGenerator3::AppendEcho(std::vector<std::string>& commands,
color_name = "--green ";
break;
case EchoLink:
- color_name = "--red --bold ";
+ color_name = "--green --bold ";
break;
case EchoGenerate:
color_name = "--blue --bold ";
@@ -1377,14 +1377,11 @@ cmLocalUnixMakefileGenerator3::AppendEcho(std::vector<std::string>& commands,
break;
}
}
-#else
- (void)color;
-#endif
// Echo one line at a time.
std::string line;
line.reserve(200);
- for(const char* c = text;; ++c)
+ for(const char* c = text.c_str();; ++c)
{
if(*c == '\n' || *c == '\0')
{
@@ -1393,7 +1390,7 @@ cmLocalUnixMakefileGenerator3::AppendEcho(std::vector<std::string>& commands,
{
// Add a command to echo this line.
std::string cmd;
- if(color_name.empty())
+ if(color_name.empty() && !progress)
{
// Use the native echo command.
cmd = "@echo ";
@@ -1404,6 +1401,17 @@ cmLocalUnixMakefileGenerator3::AppendEcho(std::vector<std::string>& commands,
// Use cmake to echo the text in color.
cmd = "@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) ";
cmd += color_name;
+ if (progress)
+ {
+ cmd += "--progress-dir=";
+ cmd += this->Convert(progress->Dir,
+ cmLocalGenerator::FULL,
+ cmLocalGenerator::SHELL);
+ cmd += " ";
+ cmd += "--progress-num=";
+ cmd += progress->Arg;
+ cmd += " ";
+ }
cmd += this->EscapeForShell(line);
}
commands.push_back(cmd);
@@ -1412,6 +1420,9 @@ cmLocalUnixMakefileGenerator3::AppendEcho(std::vector<std::string>& commands,
// Reset the line to emtpy.
line = "";
+ // Progress appears only on first line.
+ progress = 0;
+
// Terminate on end-of-string.
if(*c == '\0')
{
@@ -1617,14 +1628,10 @@ bool cmLocalUnixMakefileGenerator3::UpdateDependencies(const char* tgtInfo,
targetName = targetName.substr(0, targetName.length()-4);
std::string message = "Scanning dependencies of target ";
message += targetName;
-#ifdef CMAKE_BUILD_WITH_CMAKE
cmSystemTools::MakefileColorEcho(
cmsysTerminal_Color_ForegroundMagenta |
cmsysTerminal_Color_ForegroundBold,
message.c_str(), true, color);
-#else
- fprintf(stdout, "%s\n", message.c_str());
-#endif
return this->ScanDependencies(dir.c_str(), validDependencies);
}
@@ -2393,14 +2400,10 @@ void cmLocalUnixMakefileGenerator3
// On UNIX we must construct a single shell command to change
// directory and build because make resets the directory between
// each command.
- std::vector<std::string>::iterator i = commands.begin();
- for (; i != commands.end(); ++i)
- {
- std::string cmd = cd_cmd;
- cmd += this->ConvertToOutputForExisting(tgtDir, relRetDir);
- cmd += " && ";
- cmd += *i;
- *i = cmd;
- }
+ std::string outputForExisting =
+ this->ConvertToOutputForExisting(tgtDir, relRetDir);
+ std::string prefix = cd_cmd + outputForExisting + " && ";
+ std::transform(commands.begin(), commands.end(), commands.begin(),
+ std::bind1st(std::plus<std::string>(), prefix));
}
}
diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h
index 7c8e27f..1ff5e7f 100644
--- a/Source/cmLocalUnixMakefileGenerator3.h
+++ b/Source/cmLocalUnixMakefileGenerator3.h
@@ -184,8 +184,9 @@ public:
// append an echo command
enum EchoColor { EchoNormal, EchoDepend, EchoBuild, EchoLink,
EchoGenerate, EchoGlobal };
- void AppendEcho(std::vector<std::string>& commands, const char* text,
- EchoColor color = EchoNormal);
+ struct EchoProgress { std::string Dir; std::string Arg; };
+ void AppendEcho(std::vector<std::string>& commands, std::string const& text,
+ EchoColor color = EchoNormal, EchoProgress const* = 0);
/** Get whether the makefile is to have color. */
bool GetColorMakefile() const { return this->ColorMakefile; }
diff --git a/Source/cmLocale.h b/Source/cmLocale.h
new file mode 100644
index 0000000..727f0f5
--- /dev/null
+++ b/Source/cmLocale.h
@@ -0,0 +1,31 @@
+/*============================================================================
+ CMake - Cross Platform Makefile Generator
+ Copyright 2000-2015 Kitware, Inc., Insight Software Consortium
+
+ Distributed under the OSI-approved BSD License (the "License");
+ see accompanying file Copyright.txt for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even the
+ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the License for more information.
+============================================================================*/
+#ifndef cmLocale_h
+#define cmLocale_h
+
+#include <locale.h>
+
+class cmLocaleRAII
+{
+ const char* OldLocale;
+public:
+ cmLocaleRAII(): OldLocale(setlocale(LC_CTYPE, 0))
+ {
+ setlocale(LC_CTYPE, "");
+ }
+ ~cmLocaleRAII()
+ {
+ setlocale(LC_CTYPE, this->OldLocale);
+ }
+};
+
+#endif
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index ff3e35d..eb68e49 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -3577,19 +3577,6 @@ void cmMakefile::EnableLanguage(std::vector<std::string> const & lang,
optional);
}
-void cmMakefile::ExpandSourceListArguments(
- std::vector<std::string> const& arguments,
- std::vector<std::string>& newargs, unsigned int /* start */) const
-{
- // now expand the args
- unsigned int i;
- for(i = 0; i < arguments.size(); ++i)
- {
- // List expansion will have been done already.
- newargs.push_back(arguments[i]);
- }
-}
-
int cmMakefile::TryCompile(const std::string& srcdir,
const std::string& bindir,
const std::string& projectName,
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index 110db24..895a2fc 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -600,17 +600,6 @@ public:
*/
void AddSystemIncludeDirectories(const std::set<std::string> &incs);
- /** Expand out any arguements in the vector that have ; separated
- * strings into multiple arguements. A new vector is created
- * containing the expanded versions of all arguments in argsIn.
- * This method differes from the one in cmSystemTools in that if
- * the CmakeLists file is version 1.2 or earlier it will check for
- * source lists being used without ${} around them
- */
- void ExpandSourceListArguments(std::vector<std::string> const& argsIn,
- std::vector<std::string>& argsOut,
- unsigned int startArgumentIndex) const;
-
/** Get a cmSourceFile pointer for a given source name, if the name is
* not found, then a null pointer is returned.
*/
diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx
index d4036d2..ab58cbd 100644
--- a/Source/cmMakefileExecutableTargetGenerator.cxx
+++ b/Source/cmMakefileExecutableTargetGenerator.cxx
@@ -171,15 +171,19 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
return;
}
+ this->NumberOfProgressActions++;
if(!this->NoRuleMessages)
{
+ cmLocalUnixMakefileGenerator3::EchoProgress progress;
+ this->MakeEchoProgress(progress);
// Add the link message.
std::string buildEcho = "Linking ";
buildEcho += linkLanguage;
buildEcho += " executable ";
buildEcho += targetOutPath;
this->LocalGenerator->AppendEcho(commands, buildEcho.c_str(),
- cmLocalUnixMakefileGenerator3::EchoLink);
+ cmLocalUnixMakefileGenerator3::EchoLink,
+ &progress);
}
// Build a list of compiler flags and linker flags.
diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx
index cdda36c..84761cc 100644
--- a/Source/cmMakefileLibraryTargetGenerator.cxx
+++ b/Source/cmMakefileLibraryTargetGenerator.cxx
@@ -341,8 +341,11 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
this->Convert(targetFullPathImport,cmLocalGenerator::START_OUTPUT,
cmLocalGenerator::SHELL);
+ this->NumberOfProgressActions++;
if(!this->NoRuleMessages)
{
+ cmLocalUnixMakefileGenerator3::EchoProgress progress;
+ this->MakeEchoProgress(progress);
// Add the link message.
std::string buildEcho = "Linking ";
buildEcho += linkLanguage;
@@ -365,7 +368,8 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
}
buildEcho += targetOutPath.c_str();
this->LocalGenerator->AppendEcho(commands, buildEcho.c_str(),
- cmLocalUnixMakefileGenerator3::EchoLink);
+ cmLocalUnixMakefileGenerator3::EchoLink,
+ &progress);
}
const char* forbiddenFlagVar = 0;
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index 7ed0c10..20207f5 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -618,16 +618,19 @@ cmMakefileTargetGenerator
std::vector<std::string> commands;
// add in a progress call if needed
- this->AppendProgress(commands);
+ this->NumberOfProgressActions++;
if(!this->NoRuleMessages)
{
+ cmLocalUnixMakefileGenerator3::EchoProgress progress;
+ this->MakeEchoProgress(progress);
std::string buildEcho = "Building ";
buildEcho += lang;
buildEcho += " object ";
buildEcho += relativeObj;
this->LocalGenerator->AppendEcho
- (commands, buildEcho.c_str(), cmLocalUnixMakefileGenerator3::EchoBuild);
+ (commands, buildEcho.c_str(), cmLocalUnixMakefileGenerator3::EchoBuild,
+ &progress);
}
std::string targetOutPathReal;
@@ -1200,12 +1203,15 @@ void cmMakefileTargetGenerator
if(!comment.empty())
{
// add in a progress call if needed
- this->AppendProgress(commands);
+ this->NumberOfProgressActions++;
if(!this->NoRuleMessages)
{
+ cmLocalUnixMakefileGenerator3::EchoProgress progress;
+ this->MakeEchoProgress(progress);
this->LocalGenerator
->AppendEcho(commands, comment.c_str(),
- cmLocalUnixMakefileGenerator3::EchoGenerate);
+ cmLocalUnixMakefileGenerator3::EchoGenerate,
+ &progress);
}
}
@@ -1263,22 +1269,14 @@ void cmMakefileTargetGenerator
//----------------------------------------------------------------------------
void
-cmMakefileTargetGenerator::AppendProgress(std::vector<std::string>& commands)
+cmMakefileTargetGenerator
+::MakeEchoProgress(cmLocalUnixMakefileGenerator3::EchoProgress& progress) const
{
- this->NumberOfProgressActions++;
- if(this->NoRuleMessages)
- {
- return;
- }
- std::string progressDir = this->Makefile->GetHomeOutputDirectory();
- progressDir += cmake::GetCMakeFilesDirectory();
- std::ostringstream progCmd;
- progCmd << "$(CMAKE_COMMAND) -E cmake_progress_report ";
- progCmd << this->LocalGenerator->Convert(progressDir,
- cmLocalGenerator::FULL,
- cmLocalGenerator::SHELL);
- progCmd << " $(CMAKE_PROGRESS_" << this->NumberOfProgressActions << ")";
- commands.push_back(progCmd.str());
+ progress.Dir = this->Makefile->GetHomeOutputDirectory();
+ progress.Dir += cmake::GetCMakeFilesDirectory();
+ std::ostringstream progressArg;
+ progressArg << "$(CMAKE_PROGRESS_" << this->NumberOfProgressActions << ")";
+ progress.Arg = progressArg.str();
}
//----------------------------------------------------------------------------
diff --git a/Source/cmMakefileTargetGenerator.h b/Source/cmMakefileTargetGenerator.h
index e31e086..b072cfa 100644
--- a/Source/cmMakefileTargetGenerator.h
+++ b/Source/cmMakefileTargetGenerator.h
@@ -109,7 +109,7 @@ protected:
void GenerateExtraOutput(const char* out, const char* in,
bool symbolic = false);
- void AppendProgress(std::vector<std::string>& commands);
+ void MakeEchoProgress(cmLocalUnixMakefileGenerator3::EchoProgress&) const;
// write out the variable that lists the objects for this target
void WriteObjectsVariable(std::string& variableName,
diff --git a/Source/cmQTWrapCPPCommand.cxx b/Source/cmQTWrapCPPCommand.cxx
index a984260..878562c 100644
--- a/Source/cmQTWrapCPPCommand.cxx
+++ b/Source/cmQTWrapCPPCommand.cxx
@@ -12,19 +12,15 @@
#include "cmQTWrapCPPCommand.h"
// cmQTWrapCPPCommand
-bool cmQTWrapCPPCommand::InitialPass(std::vector<std::string> const& argsIn,
+bool cmQTWrapCPPCommand::InitialPass(std::vector<std::string> const& args,
cmExecutionStatus &)
{
- if(argsIn.size() < 3 )
+ if(args.size() < 3 )
{
this->SetError("called with incorrect number of arguments");
return false;
}
- // This command supports source list inputs for compatibility.
- std::vector<std::string> args;
- this->Makefile->ExpandSourceListArguments(argsIn, args, 2);
-
// Get the moc executable to run in the custom command.
const char* moc_exe =
this->Makefile->GetRequiredDefinition("QT_MOC_EXECUTABLE");
@@ -35,7 +31,7 @@ bool cmQTWrapCPPCommand::InitialPass(std::vector<std::string> const& argsIn,
this->Makefile->GetSafeDefinition(sourceList);
// Create a rule for all sources listed.
- for(std::vector<std::string>::iterator j = (args.begin() + 2);
+ for(std::vector<std::string>::const_iterator j = (args.begin() + 2);
j != args.end(); ++j)
{
cmSourceFile *curr = this->Makefile->GetSource(*j);
diff --git a/Source/cmQTWrapUICommand.cxx b/Source/cmQTWrapUICommand.cxx
index dce59ef..9b92b1e 100644
--- a/Source/cmQTWrapUICommand.cxx
+++ b/Source/cmQTWrapUICommand.cxx
@@ -12,19 +12,15 @@
#include "cmQTWrapUICommand.h"
// cmQTWrapUICommand
-bool cmQTWrapUICommand::InitialPass(std::vector<std::string> const& argsIn,
+bool cmQTWrapUICommand::InitialPass(std::vector<std::string> const& args,
cmExecutionStatus &)
{
- if(argsIn.size() < 4 )
+ if(args.size() < 4 )
{
this->SetError("called with incorrect number of arguments");
return false;
}
- // This command supports source list inputs for compatibility.
- std::vector<std::string> args;
- this->Makefile->ExpandSourceListArguments(argsIn, args, 3);
-
// Get the uic and moc executables to run in the custom commands.
const char* uic_exe =
this->Makefile->GetRequiredDefinition("QT_UIC_EXECUTABLE");
@@ -40,7 +36,7 @@ bool cmQTWrapUICommand::InitialPass(std::vector<std::string> const& argsIn,
this->Makefile->GetSafeDefinition(sourceList);
// Create rules for all sources listed.
- for(std::vector<std::string>::iterator j = (args.begin() + 3);
+ for(std::vector<std::string>::const_iterator j = (args.begin() + 3);
j != args.end(); ++j)
{
cmSourceFile *curr = this->Makefile->GetSource(*j);
diff --git a/Source/cmSetTargetPropertiesCommand.cxx b/Source/cmSetTargetPropertiesCommand.cxx
index aeb8077..e41a0ca 100644
--- a/Source/cmSetTargetPropertiesCommand.cxx
+++ b/Source/cmSetTargetPropertiesCommand.cxx
@@ -35,19 +35,12 @@ bool cmSetTargetPropertiesCommand
doingFiles = false;
// now loop through the rest of the arguments, new style
++j;
- while (j != args.end())
+ if (std::distance(j, args.end()) % 2 != 0)
{
- propertyPairs.push_back(*j);
- ++j;
- if(j == args.end())
- {
- this->SetError("called with incorrect number of arguments.");
- return false;
- }
- propertyPairs.push_back(*j);
- ++j;
+ this->SetError("called with incorrect number of arguments.");
+ return false;
}
- // break out of the loop because j is already == end
+ propertyPairs.insert(propertyPairs.end(), j, args.end());
break;
}
else if (doingFiles)
diff --git a/Source/cmSetTestsPropertiesCommand.cxx b/Source/cmSetTestsPropertiesCommand.cxx
index e66d13d..d079a19 100644
--- a/Source/cmSetTestsPropertiesCommand.cxx
+++ b/Source/cmSetTestsPropertiesCommand.cxx
@@ -36,19 +36,12 @@ bool cmSetTestsPropertiesCommand
doingFiles = false;
// now loop through the rest of the arguments, new style
++j;
- while (j != args.end())
+ if (std::distance(j, args.end()) % 2 != 0)
{
- propertyPairs.push_back(*j);
- ++j;
- if(j == args.end())
- {
- this->SetError("called with incorrect number of arguments.");
- return false;
- }
- propertyPairs.push_back(*j);
- ++j;
+ this->SetError("called with incorrect number of arguments.");
+ return false;
}
- // break out of the loop because j is already == end
+ propertyPairs.insert(propertyPairs.end(), j, args.end());
break;
}
else if (doingFiles)
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index e9735ed..7dd6121 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -26,11 +26,12 @@
#include <cmsys/Encoding.hxx>
#if defined(CMAKE_BUILD_WITH_CMAKE)
# include "cmArchiveWrite.h"
+# include "cmLocale.h"
# include <cm_libarchive.h>
-# include <cmsys/Terminal.h>
#endif
#include <cmsys/stl/algorithm>
#include <cmsys/FStream.hxx>
+#include <cmsys/Terminal.h>
#if defined(_WIN32)
# include <windows.h>
@@ -366,13 +367,17 @@ bool cmSystemTools::IsInternallyOn(const char* val)
return false;
}
std::basic_string<char> v = val;
+ if (v.size() > 4)
+ {
+ return false;
+ }
for(std::basic_string<char>::iterator c = v.begin();
c != v.end(); c++)
{
*c = static_cast<char>(toupper(*c));
}
- return (v == "I_ON" || v == "i_on");
+ return v == "I_ON";
}
bool cmSystemTools::IsOn(const char* val)
@@ -1690,6 +1695,8 @@ long copy_data(struct archive *ar, struct archive *aw)
bool extract_tar(const char* outFileName, bool verbose,
bool extract)
{
+ cmLocaleRAII localeRAII;
+ static_cast<void>(localeRAII);
struct archive* a = archive_read_new();
struct archive *ext = archive_write_disk_new();
archive_read_support_compression_all(a);
@@ -2284,7 +2291,6 @@ std::string const& cmSystemTools::GetCMakeRoot()
}
//----------------------------------------------------------------------------
-#if defined(CMAKE_BUILD_WITH_CMAKE)
void cmSystemTools::MakefileColorEcho(int color, const char* message,
bool newline, bool enabled)
{
@@ -2305,16 +2311,21 @@ void cmSystemTools::MakefileColorEcho(int color, const char* message,
if(enabled)
{
- cmsysTerminal_cfprintf(color | assumeTTY, stdout, "%s%s",
- message, newline? "\n" : "");
+ // Print with color. Delay the newline until later so that
+ // all color restore sequences appear before it.
+ cmsysTerminal_cfprintf(color | assumeTTY, stdout, "%s", message);
}
else
{
// Color is disabled. Print without color.
- fprintf(stdout, "%s%s", message, newline? "\n" : "");
+ fprintf(stdout, "%s", message);
+ }
+
+ if(newline)
+ {
+ fprintf(stdout, "\n");
}
}
-#endif
//----------------------------------------------------------------------------
bool cmSystemTools::GuessLibrarySOName(std::string const& fullPath,
@@ -2695,7 +2706,7 @@ bool cmSystemTools::RemoveRPath(std::string const& file, std::string* emsg,
}
if(se_count == 2 && se[1]->IndexInSection < se[0]->IndexInSection)
{
- cmsys_stl::swap(se[0], se[1]);
+ std::swap(se[0], se[1]);
}
// Get the size of the dynamic section header.
diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h
index 361f42e..c59ae96 100644
--- a/Source/cmSystemTools.h
+++ b/Source/cmSystemTools.h
@@ -428,11 +428,9 @@ public:
static std::string const& GetCMakeCursesCommand();
static std::string const& GetCMakeRoot();
-#if defined(CMAKE_BUILD_WITH_CMAKE)
/** Echo a message in color using KWSys's Terminal cprintf. */
static void MakefileColorEcho(int color, const char* message,
bool newLine, bool enabled);
-#endif
/** Try to guess the soname of a shared library. */
static bool GuessLibrarySOName(std::string const& fullPath,
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 98cb75c..f0bdea7 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -1153,15 +1153,11 @@ cmTarget::LinkLibraryType cmTarget::ComputeLinkType(
// Check if any entry in the list matches this configuration.
std::string configUpper = cmSystemTools::UpperCase(config);
- for(std::vector<std::string>::const_iterator i = debugConfigs.begin();
- i != debugConfigs.end(); ++i)
+ if (std::find(debugConfigs.begin(), debugConfigs.end(), configUpper) !=
+ debugConfigs.end())
{
- if(*i == configUpper)
- {
- return cmTarget::DEBUG;
- }
+ return cmTarget::DEBUG;
}
-
// The current configuration is not a debug configuration.
return cmTarget::OPTIMIZED;
}
@@ -5919,8 +5915,7 @@ cmTarget::GetCompatibleInterfaces(std::string const& config) const
{ \
std::vector<std::string> props; \
cmSystemTools::ExpandListArgument(prop, props); \
- std::copy(props.begin(), props.end(), \
- std::inserter(compat.Props##x, compat.Props##x.begin())); \
+ compat.Props##x.insert(props.begin(), props.end()); \
}
CM_READ_COMPATIBLE_INTERFACE(BOOL, Bool)
CM_READ_COMPATIBLE_INTERFACE(STRING, String)
diff --git a/Source/cmXMLSafe.cxx b/Source/cmXMLSafe.cxx
index 72fdc34..99f5625 100644
--- a/Source/cmXMLSafe.cxx
+++ b/Source/cmXMLSafe.cxx
@@ -28,7 +28,7 @@ cmXMLSafe::cmXMLSafe(const char* s):
}
//----------------------------------------------------------------------------
-cmXMLSafe::cmXMLSafe(cmsys_stl::string const& s):
+cmXMLSafe::cmXMLSafe(std::string const& s):
Data(s.c_str()),
Size(static_cast<unsigned long>(s.length())),
DoQuotes(true)
@@ -43,7 +43,7 @@ cmXMLSafe& cmXMLSafe::Quotes(bool b)
}
//----------------------------------------------------------------------------
-cmsys_stl::string cmXMLSafe::str()
+std::string cmXMLSafe::str()
{
cmsys_ios::ostringstream ss;
ss << *this;
diff --git a/Source/cmXMLSafe.h b/Source/cmXMLSafe.h
index cba9f39..c23a90c 100644
--- a/Source/cmXMLSafe.h
+++ b/Source/cmXMLSafe.h
@@ -24,7 +24,7 @@ public:
/** Construct with the data to be written. This assumes the data
will exist for the duration of this object's life. */
cmXMLSafe(const char* s);
- cmXMLSafe(cmsys_stl::string const& s);
+ cmXMLSafe(std::string const& s);
/** Specify whether to escape quotes too. This is needed when
writing the content of an attribute value. By default quotes
@@ -32,7 +32,7 @@ public:
cmXMLSafe& Quotes(bool b = true);
/** Get the escaped data as a string. */
- cmsys_stl::string str();
+ std::string str();
private:
char const* Data;
unsigned long Size;
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 4b6af0a..47be481 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -2733,11 +2733,10 @@ std::vector<std::string> const& cmake::GetDebugConfigs()
{
// Expand the specified list and convert to upper-case.
cmSystemTools::ExpandListArgument(config_list, this->DebugConfigs);
- for(std::vector<std::string>::iterator i = this->DebugConfigs.begin();
- i != this->DebugConfigs.end(); ++i)
- {
- *i = cmSystemTools::UpperCase(*i);
- }
+ std::transform(this->DebugConfigs.begin(),
+ this->DebugConfigs.end(),
+ this->DebugConfigs.begin(),
+ cmSystemTools::UpperCase);
}
// If no configurations were specified, use a default list.
if(this->DebugConfigs.empty())
diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx
index 6d25b70..e0bd55b 100644
--- a/Source/cmakemain.cxx
+++ b/Source/cmakemain.cxx
@@ -25,7 +25,6 @@
#include "cmLocalGenerator.h"
#include "cmMakefile.h"
#include <cmsys/Encoding.hxx>
-#include <locale.h>
#ifdef CMAKE_BUILD_WITH_CMAKE
//----------------------------------------------------------------------------
@@ -173,7 +172,6 @@ static void cmakemainProgressCallback(const char *m, float prog,
int main(int ac, char const* const* av)
{
- setlocale(LC_CTYPE, "");
cmsys::Encoding::CommandLineArguments args =
cmsys::Encoding::CommandLineArguments::Main(ac, av);
ac = args.argc();
diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx
index 28fcd27..5260cb0 100644
--- a/Source/cmcmd.cxx
+++ b/Source/cmcmd.cxx
@@ -18,12 +18,12 @@
#if defined(CMAKE_BUILD_WITH_CMAKE)
# include "cmDependsFortran.h" // For -E cmake_copy_f90_mod callback.
-# include <cmsys/Terminal.h>
#endif
#include <cmsys/Directory.hxx>
#include <cmsys/Process.h>
#include <cmsys/FStream.hxx>
+#include <cmsys/Terminal.h>
#if defined(CMAKE_HAVE_VS_GENERATORS)
#include "cmCallVisualStudioMacro.h"
@@ -534,48 +534,9 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
// Command to report progress for a build
else if (args[1] == "cmake_progress_report" && args.size() >= 3)
{
- std::string dirName = args[2];
- dirName += "/Progress";
- std::string fName;
- FILE *progFile;
-
- // read the count
- fName = dirName;
- fName += "/count.txt";
- progFile = cmsys::SystemTools::Fopen(fName,"r");
- int count = 0;
- if (!progFile)
- {
- return 0;
- }
- else
- {
- if (1!=fscanf(progFile,"%i",&count))
- {
- cmSystemTools::Message("Could not read from progress file.");
- }
- fclose(progFile);
- }
- unsigned int i;
- for (i = 3; i < args.size(); ++i)
- {
- fName = dirName;
- fName += "/";
- fName += args[i];
- progFile = cmsys::SystemTools::Fopen(fName,"w");
- if (progFile)
- {
- fprintf(progFile,"empty");
- fclose(progFile);
- }
- }
- int fileNum = static_cast<int>
- (cmsys::Directory::GetNumberOfFilesInDirectory(dirName));
- if (count > 0)
- {
- // print the progress
- fprintf(stdout,"[%3i%%] ",((fileNum-3)*100)/count);
- }
+ // This has been superseded by cmake_echo_color --progress-*
+ // options. We leave it here to avoid errors if somehow this
+ // is invoked by an existing makefile without regenerating.
return 0;
}
@@ -753,12 +714,12 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
{
return cmcmd::VisualStudioLink(args, 2);
}
-#ifdef CMAKE_BUILD_WITH_CMAKE
// Internal CMake color makefile support.
else if (args[1] == "cmake_echo_color")
{
return cmcmd::ExecuteEchoColor(args);
}
+#ifdef CMAKE_BUILD_WITH_CMAKE
else if (args[1] == "cmake_autogen" && args.size() >= 4)
{
cmQtAutoGenerators autogen;
@@ -987,7 +948,65 @@ bool cmcmd::SymlinkInternal(std::string const& file, std::string const& link)
}
//----------------------------------------------------------------------------
-#ifdef CMAKE_BUILD_WITH_CMAKE
+static void cmcmdProgressReport(std::string const& dir,
+ std::string const& num)
+{
+ std::string dirName = dir;
+ dirName += "/Progress";
+ std::string fName;
+ FILE *progFile;
+
+ // read the count
+ fName = dirName;
+ fName += "/count.txt";
+ progFile = cmsys::SystemTools::Fopen(fName,"r");
+ int count = 0;
+ if (!progFile)
+ {
+ return;
+ }
+ else
+ {
+ if (1!=fscanf(progFile,"%i",&count))
+ {
+ cmSystemTools::Message("Could not read from progress file.");
+ }
+ fclose(progFile);
+ }
+ const char* last = num.c_str();
+ for(const char* c = last;; ++c)
+ {
+ if (*c == ',' || *c == '\0')
+ {
+ if (c != last)
+ {
+ fName = dirName;
+ fName += "/";
+ fName.append(last, c-last);
+ progFile = cmsys::SystemTools::Fopen(fName,"w");
+ if (progFile)
+ {
+ fprintf(progFile,"empty");
+ fclose(progFile);
+ }
+ }
+ if(*c == '\0')
+ {
+ break;
+ }
+ last = c + 1;
+ }
+ }
+ int fileNum = static_cast<int>
+ (cmsys::Directory::GetNumberOfFilesInDirectory(dirName));
+ if (count > 0)
+ {
+ // print the progress
+ fprintf(stdout,"[%3i%%] ",((fileNum-3)*100)/count);
+ }
+}
+
+//----------------------------------------------------------------------------
int cmcmd::ExecuteEchoColor(std::vector<std::string>& args)
{
// The arguments are
@@ -997,6 +1016,7 @@ int cmcmd::ExecuteEchoColor(std::vector<std::string>& args)
bool enabled = true;
int color = cmsysTerminal_Color_Normal;
bool newline = true;
+ std::string progressDir;
for(unsigned int i=2; i < args.size(); ++i)
{
if(args[i].find("--switch=") == 0)
@@ -1015,6 +1035,18 @@ int cmcmd::ExecuteEchoColor(std::vector<std::string>& args)
}
}
}
+ else if(cmHasLiteralPrefix(args[i], "--progress-dir="))
+ {
+ progressDir = args[i].substr(15);
+ }
+ else if(cmHasLiteralPrefix(args[i], "--progress-num="))
+ {
+ if (!progressDir.empty())
+ {
+ std::string const& progressNum = args[i].substr(15);
+ cmcmdProgressReport(progressDir, progressNum);
+ }
+ }
else if(args[i] == "--normal")
{
color = cmsysTerminal_Color_Normal;
@@ -1073,12 +1105,6 @@ int cmcmd::ExecuteEchoColor(std::vector<std::string>& args)
return 0;
}
-#else
-int cmcmd::ExecuteEchoColor(std::vector<std::string>&)
-{
- return 1;
-}
-#endif
//----------------------------------------------------------------------------
int cmcmd::ExecuteLinkScript(std::vector<std::string>& args)
diff --git a/Source/ctest.cxx b/Source/ctest.cxx
index b77c231..c0eb8ac 100644
--- a/Source/ctest.cxx
+++ b/Source/ctest.cxx
@@ -19,7 +19,6 @@
#include "CTest/cmCTestScriptHandler.h"
#include "CTest/cmCTestLaunch.h"
#include "cmsys/Encoding.hxx"
-#include <locale.h>
//----------------------------------------------------------------------------
static const char * cmDocumentationName[][2] =
@@ -117,8 +116,6 @@ static const char * cmDocumentationOptions[][2] =
// this is a test driver program for cmCTest.
int main (int argc, char const* const* argv)
{
- setlocale(LC_CTYPE, "");
-
cmsys::Encoding::CommandLineArguments encoding_args =
cmsys::Encoding::CommandLineArguments::Main(argc, argv);
argc = encoding_args.argc();