summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/CMakeLists.txt2
-rw-r--r--Source/CMakeVersion.cmake4
-rw-r--r--Source/CPack/OSXScriptLauncher.cxx8
-rw-r--r--Source/CPack/WiX/cmCPackWIXGenerator.cxx14
-rw-r--r--Source/CPack/WiX/cmCPackWIXGenerator.h4
-rw-r--r--Source/CPack/cmCPackGenerator.cxx1
-rw-r--r--Source/CPack/cmCPackGeneratorFactory.cxx1
-rw-r--r--Source/CPack/cmCPackNSISGenerator.cxx2
-rw-r--r--Source/CTest/cmCTestBuildAndTestHandler.cxx3
-rw-r--r--Source/CTest/cmCTestBuildHandler.h2
-rw-r--r--Source/CTest/cmCTestCoverageHandler.cxx4
-rw-r--r--Source/CTest/cmCTestGIT.cxx1
-rw-r--r--Source/CTest/cmCTestGlobalVC.h2
-rw-r--r--Source/CTest/cmCTestMultiProcessHandler.cxx1
-rw-r--r--Source/CTest/cmCTestSVN.h2
-rw-r--r--Source/QtDialog/CMakeSetup.cxx6
-rw-r--r--Source/cmAddLibraryCommand.cxx6
-rw-r--r--Source/cmAlgorithms.h281
-rw-r--r--Source/cmCPluginAPI.cxx7
-rw-r--r--Source/cmCommands.h2
-rw-r--r--Source/cmComputeLinkDepends.cxx7
-rw-r--r--Source/cmConditionEvaluator.h2
-rw-r--r--Source/cmCoreTryCompile.cxx9
-rw-r--r--Source/cmExportBuildFileGenerator.cxx13
-rw-r--r--Source/cmExportFileGenerator.cxx136
-rw-r--r--Source/cmExportFileGenerator.h5
-rw-r--r--Source/cmExportInstallFileGenerator.cxx38
-rw-r--r--Source/cmExportSet.cxx1
-rw-r--r--Source/cmExportSetMap.cxx1
-rw-r--r--Source/cmFLTKWrapUICommand.cxx7
-rw-r--r--Source/cmFileCommand.cxx10
-rw-r--r--Source/cmFileLockPool.cxx1
-rw-r--r--Source/cmFileLockPool.h2
-rw-r--r--Source/cmFindBase.cxx8
-rw-r--r--Source/cmFindLibraryCommand.cxx4
-rw-r--r--Source/cmFindPackageCommand.cxx19
-rw-r--r--Source/cmFunctionCommand.cxx33
-rw-r--r--Source/cmGeneratorExpressionEvaluator.cxx5
-rw-r--r--Source/cmGetCMakePropertyCommand.cxx19
-rw-r--r--Source/cmGlobalGenerator.cxx8
-rw-r--r--Source/cmGlobalUnixMakefileGenerator3.cxx43
-rw-r--r--Source/cmGlobalVisualStudio7Generator.h3
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx160
-rw-r--r--Source/cmInstallDirectoryGenerator.cxx4
-rw-r--r--Source/cmInstallExportGenerator.cxx8
-rw-r--r--Source/cmInstallExportGenerator.h3
-rw-r--r--Source/cmInstallFilesCommand.cxx7
-rw-r--r--Source/cmInstallFilesGenerator.cxx1
-rw-r--r--Source/cmInstallGenerator.cxx14
-rw-r--r--Source/cmInstallGenerator.h9
-rw-r--r--Source/cmInstallTargetGenerator.cxx17
-rw-r--r--Source/cmInstallTargetGenerator.h2
-rw-r--r--Source/cmInstalledFile.h1
-rw-r--r--Source/cmListCommand.cxx143
-rw-r--r--Source/cmLocalGenerator.cxx50
-rw-r--r--Source/cmLocalUnixMakefileGenerator3.cxx73
-rw-r--r--Source/cmLocalUnixMakefileGenerator3.h5
-rw-r--r--Source/cmLocalVisualStudio7Generator.cxx16
-rw-r--r--Source/cmMacroCommand.cxx107
-rw-r--r--Source/cmMakefile.cxx58
-rw-r--r--Source/cmMakefile.h12
-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/cmMessageCommand.cxx6
-rw-r--r--Source/cmOptionCommand.cxx6
-rw-r--r--Source/cmQTWrapCPPCommand.cxx10
-rw-r--r--Source/cmQTWrapUICommand.cxx10
-rw-r--r--Source/cmQtAutoGenerators.h2
-rw-r--r--Source/cmRST.cxx1
-rw-r--r--Source/cmSetCommand.cxx12
-rw-r--r--Source/cmSetTargetPropertiesCommand.cxx15
-rw-r--r--Source/cmSetTestsPropertiesCommand.cxx15
-rw-r--r--Source/cmStandardIncludes.h146
-rw-r--r--Source/cmStringCommand.cxx42
-rw-r--r--Source/cmSystemTools.cxx25
-rw-r--r--Source/cmSystemTools.h2
-rw-r--r--Source/cmTarget.cxx54
-rw-r--r--Source/cmVariableWatch.cxx2
-rw-r--r--Source/cmXMLSafe.cxx4
-rw-r--r--Source/cmXMLSafe.h4
-rw-r--r--Source/cmake.cxx11
-rw-r--r--Source/cmcmd.cxx147
84 files changed, 975 insertions, 1006 deletions
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt
index 8a83c3e..69bc2a1 100644
--- a/Source/CMakeLists.txt
+++ b/Source/CMakeLists.txt
@@ -520,8 +520,8 @@ if(APPLE)
target_link_libraries(CMakeLib "-framework CoreFoundation")
endif()
-# On some platforms we need the rpcrt4 library for the VS 7 generators.
if(CMAKE_BUILD_ON_VISUAL_STUDIO OR MINGW)
+ # We need the rpcrt4 library for at least the VS7-VC10 generators.
target_link_libraries(CMakeLib rpcrt4)
endif()
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index 8ffe8c4..5f5e676 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 0)
-set(CMake_VERSION_RC 1)
+set(CMake_VERSION_PATCH 20150220)
+#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/WiX/cmCPackWIXGenerator.cxx b/Source/CPack/WiX/cmCPackWIXGenerator.cxx
index 59c38e9..11d5437 100644
--- a/Source/CPack/WiX/cmCPackWIXGenerator.cxx
+++ b/Source/CPack/WiX/cmCPackWIXGenerator.cxx
@@ -1,6 +1,6 @@
/*============================================================================
CMake - Cross Platform Makefile Generator
- Copyright 2000-2014 Kitware, Inc., Insight Software Consortium
+ Copyright 2012-2015 Kitware, Inc., Insight Software Consortium
Distributed under the OSI-approved BSD License (the "License");
see accompanying file Copyright.txt for details.
@@ -257,6 +257,7 @@ bool cmCPackWIXGenerator::PackageFilesImpl()
CreateWiXVariablesIncludeFile();
CreateWiXPropertiesIncludeFile();
+ CreateWiXProductFragmentIncludeFile();
if(!CreateWiXSourceFiles())
{
@@ -385,6 +386,17 @@ void cmCPackWIXGenerator::CreateWiXPropertiesIncludeFile()
}
}
+void cmCPackWIXGenerator::CreateWiXProductFragmentIncludeFile()
+{
+ std::string includeFilename =
+ this->CPackTopLevel + "/product_fragment.wxi";
+
+ cmWIXSourceWriter includeFile(
+ this->Logger, includeFilename, true);
+
+ this->Patch->ApplyFragment("#PRODUCT", includeFile);
+}
+
void cmCPackWIXGenerator::CopyDefinition(
cmWIXSourceWriter &source, std::string const& name)
{
diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.h b/Source/CPack/WiX/cmCPackWIXGenerator.h
index 8705d40..7035297 100644
--- a/Source/CPack/WiX/cmCPackWIXGenerator.h
+++ b/Source/CPack/WiX/cmCPackWIXGenerator.h
@@ -1,6 +1,6 @@
/*============================================================================
CMake - Cross Platform Makefile Generator
- Copyright 2000-2012 Kitware, Inc.
+ Copyright 2012-2015 Kitware, Inc.
Distributed under the OSI-approved BSD License (the "License");
see accompanying file Copyright.txt for details.
@@ -76,6 +76,8 @@ private:
void CreateWiXPropertiesIncludeFile();
+ void CreateWiXProductFragmentIncludeFile();
+
void CopyDefinition(
cmWIXSourceWriter &source, std::string const& name);
diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx
index 1c670d2..006239a 100644
--- a/Source/CPack/cmCPackGenerator.cxx
+++ b/Source/CPack/cmCPackGenerator.cxx
@@ -25,6 +25,7 @@
#include <cmsys/Glob.hxx>
#include <cmsys/FStream.hxx>
#include <algorithm>
+#include <list>
#if defined(__HAIKU__)
#include <FindDirectory.h>
diff --git a/Source/CPack/cmCPackGeneratorFactory.cxx b/Source/CPack/cmCPackGeneratorFactory.cxx
index a07c29a..4626142 100644
--- a/Source/CPack/cmCPackGeneratorFactory.cxx
+++ b/Source/CPack/cmCPackGeneratorFactory.cxx
@@ -46,6 +46,7 @@
#endif
#include "cmCPackLog.h"
+#include "cmAlgorithms.h"
//----------------------------------------------------------------------
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/CTest/cmCTestBuildAndTestHandler.cxx b/Source/CTest/cmCTestBuildAndTestHandler.cxx
index d90aeb7..4cdce71 100644
--- a/Source/CTest/cmCTestBuildAndTestHandler.cxx
+++ b/Source/CTest/cmCTestBuildAndTestHandler.cxx
@@ -32,8 +32,7 @@ cmCTestBuildAndTestHandler::cmCTestBuildAndTestHandler()
//----------------------------------------------------------------------
void cmCTestBuildAndTestHandler::Initialize()
{
- this->BuildTargets.erase(
- this->BuildTargets.begin(), this->BuildTargets.end());
+ this->BuildTargets.clear();
this->Superclass::Initialize();
}
diff --git a/Source/CTest/cmCTestBuildHandler.h b/Source/CTest/cmCTestBuildHandler.h
index 09346f9..d13d5cf 100644
--- a/Source/CTest/cmCTestBuildHandler.h
+++ b/Source/CTest/cmCTestBuildHandler.h
@@ -19,6 +19,8 @@
#include <cmsys/RegularExpression.hxx>
+#include <deque>
+
class cmMakefile;
/** \class cmCTestBuildHandler
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/CTest/cmCTestGIT.cxx b/Source/CTest/cmCTestGIT.cxx
index 98bc9d7..6b84bab 100644
--- a/Source/CTest/cmCTestGIT.cxx
+++ b/Source/CTest/cmCTestGIT.cxx
@@ -13,6 +13,7 @@
#include "cmCTest.h"
#include "cmSystemTools.h"
+#include "cmAlgorithms.h"
#include "cmXMLSafe.h"
#include <cmsys/RegularExpression.hxx>
diff --git a/Source/CTest/cmCTestGlobalVC.h b/Source/CTest/cmCTestGlobalVC.h
index cb0d165..29e0a61 100644
--- a/Source/CTest/cmCTestGlobalVC.h
+++ b/Source/CTest/cmCTestGlobalVC.h
@@ -14,6 +14,8 @@
#include "cmCTestVC.h"
+#include <list>
+
/** \class cmCTestGlobalVC
* \brief Base class for handling globally-versioned trees
*
diff --git a/Source/CTest/cmCTestMultiProcessHandler.cxx b/Source/CTest/cmCTestMultiProcessHandler.cxx
index f9e8a3c..f223127 100644
--- a/Source/CTest/cmCTestMultiProcessHandler.cxx
+++ b/Source/CTest/cmCTestMultiProcessHandler.cxx
@@ -16,6 +16,7 @@
#include "cmSystemTools.h"
#include <stdlib.h>
#include <stack>
+#include <list>
#include <float.h>
#include <cmsys/FStream.hxx>
diff --git a/Source/CTest/cmCTestSVN.h b/Source/CTest/cmCTestSVN.h
index c6548e3..17bf7cb 100644
--- a/Source/CTest/cmCTestSVN.h
+++ b/Source/CTest/cmCTestSVN.h
@@ -14,6 +14,8 @@
#include "cmCTestGlobalVC.h"
+#include <list>
+
/** \class cmCTestSVN
* \brief Interaction with subversion command-line tool
*
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/cmAlgorithms.h b/Source/cmAlgorithms.h
new file mode 100644
index 0000000..8491838
--- /dev/null
+++ b/Source/cmAlgorithms.h
@@ -0,0 +1,281 @@
+/*============================================================================
+ CMake - Cross Platform Makefile Generator
+ Copyright 2015 Stephen Kelly <steveire@gmail.com>
+
+ 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 cmAlgorithms_h
+#define cmAlgorithms_h
+
+#include "cmStandardIncludes.h"
+
+inline bool cmHasLiteralPrefixImpl(const std::string &str1,
+ const char *str2,
+ size_t N)
+{
+ return strncmp(str1.c_str(), str2, N) == 0;
+}
+
+inline bool cmHasLiteralPrefixImpl(const char* str1,
+ const char *str2,
+ size_t N)
+{
+ return strncmp(str1, str2, N) == 0;
+}
+
+inline bool cmHasLiteralSuffixImpl(const std::string &str1,
+ const char *str2,
+ size_t N)
+{
+ size_t len = str1.size();
+ return len >= N && strcmp(str1.c_str() + len - N, str2) == 0;
+}
+
+inline bool cmHasLiteralSuffixImpl(const char* str1,
+ const char* str2,
+ size_t N)
+{
+ size_t len = strlen(str1);
+ return len >= N && strcmp(str1 + len - N, str2) == 0;
+}
+
+template<typename T, size_t N>
+const T* cmArrayBegin(const T (&a)[N]) { return a; }
+template<typename T, size_t N>
+const T* cmArrayEnd(const T (&a)[N]) { return a + N; }
+template<typename T, size_t N>
+size_t cmArraySize(const T (&)[N]) { return N; }
+
+template<typename T, size_t N>
+bool cmHasLiteralPrefix(T str1, const char (&str2)[N])
+{
+ return cmHasLiteralPrefixImpl(str1, str2, N - 1);
+}
+
+template<typename T, size_t N>
+bool cmHasLiteralSuffix(T str1, const char (&str2)[N])
+{
+ return cmHasLiteralSuffixImpl(str1, str2, N - 1);
+}
+
+struct cmStrCmp {
+ cmStrCmp(const char *test) : m_test(test) {}
+ cmStrCmp(const std::string &test) : m_test(test) {}
+
+ bool operator()(const std::string& input) const
+ {
+ return m_test == input;
+ }
+
+ bool operator()(const char * input) const
+ {
+ return strcmp(input, m_test.c_str()) == 0;
+ }
+
+private:
+ const std::string m_test;
+};
+
+namespace ContainerAlgorithms {
+
+template<typename T>
+struct cmIsPair
+{
+ enum { value = false };
+};
+
+template<typename K, typename V>
+struct cmIsPair<std::pair<K, V> >
+{
+ enum { value = true };
+};
+
+template<typename Container,
+ bool valueTypeIsPair = cmIsPair<typename Container::value_type>::value>
+struct DefaultDeleter
+{
+ void operator()(typename Container::value_type value) const {
+ delete value;
+ }
+};
+
+template<typename Container>
+struct DefaultDeleter<Container, /* valueTypeIsPair = */ true>
+{
+ void operator()(typename Container::value_type value) const {
+ delete value.second;
+ }
+};
+
+template<typename const_iterator_>
+struct Range
+{
+ typedef const_iterator_ const_iterator;
+ typedef typename std::iterator_traits<const_iterator>::value_type value_type;
+ Range(const_iterator begin_, const_iterator end_)
+ : Begin(begin_), End(end_) {}
+ const_iterator begin() const { return Begin; }
+ const_iterator end() const { return End; }
+ bool empty() const { return std::distance(Begin, End) == 0; }
+ Range& advance(cmIML_INT_intptr_t amount)
+ {
+ std::advance(Begin, amount);
+ return *this;
+ }
+
+ Range& retreat(cmIML_INT_intptr_t amount)
+ {
+ std::advance(End, -amount);
+ return *this;
+ }
+private:
+ const_iterator Begin;
+ const_iterator End;
+};
+
+template<typename BiDirIt>
+BiDirIt Rotate(BiDirIt first, BiDirIt middle, BiDirIt last)
+{
+ typename std::iterator_traits<BiDirIt>::difference_type dist =
+ std::distance(first, middle);
+ std::rotate(first, middle, last);
+ std::advance(last, -dist);
+ return last;
+}
+
+template<typename Iter>
+Iter RemoveN(Iter i1, Iter i2, size_t n)
+{
+ return ContainerAlgorithms::Rotate(i1, i1 + n, i2);
+}
+
+template<typename Range>
+struct BinarySearcher
+{
+ typedef typename Range::value_type argument_type;
+ BinarySearcher(Range const& r)
+ : m_range(r)
+ {
+ }
+
+ bool operator()(argument_type const& item) const
+ {
+ return std::binary_search(m_range.begin(), m_range.end(), item);
+ }
+private:
+ Range const& m_range;
+};
+
+}
+
+template<typename Iter1, typename Iter2>
+ContainerAlgorithms::Range<Iter1> cmRange(Iter1 begin, Iter2 end)
+{
+ return ContainerAlgorithms::Range<Iter1>(begin, end);
+}
+
+template<typename Range>
+ContainerAlgorithms::Range<typename Range::const_iterator>
+cmRange(Range const& range)
+{
+ return ContainerAlgorithms::Range<typename Range::const_iterator>(
+ range.begin(), range.end());
+}
+
+template<typename Container>
+void cmDeleteAll(Container const& c)
+{
+ std::for_each(c.begin(), c.end(),
+ ContainerAlgorithms::DefaultDeleter<Container>());
+}
+
+template<typename Range>
+std::string cmJoin(Range const& r, const char* delimiter)
+{
+ if (r.empty())
+ {
+ return std::string();
+ }
+ std::ostringstream os;
+ typedef typename Range::value_type ValueType;
+ typedef typename Range::const_iterator InputIt;
+ InputIt first = r.begin();
+ InputIt last = r.end();
+ --last;
+ std::copy(first, last,
+ std::ostream_iterator<ValueType>(os, delimiter));
+
+ os << *last;
+
+ return os.str();
+}
+
+template<typename Range>
+std::string cmJoin(Range const& r, std::string delimiter)
+{
+ return cmJoin(r, delimiter.c_str());
+};
+
+template<typename Range>
+typename Range::const_iterator cmRemoveN(Range& r, size_t n)
+{
+ return ContainerAlgorithms::RemoveN(r.begin(), r.end(), n);
+}
+
+template<typename Range, typename InputRange>
+typename Range::const_iterator cmRemoveIndices(Range& r, InputRange const& rem)
+{
+ typename InputRange::const_iterator remIt = rem.begin();
+
+ typename Range::iterator writer = r.begin() + *remIt;
+ ++remIt;
+ size_t count = 1;
+ for ( ; writer != r.end() && remIt != rem.end(); ++count, ++remIt)
+ {
+ writer = ContainerAlgorithms::RemoveN(writer, r.begin() + *remIt, count);
+ }
+ writer = ContainerAlgorithms::RemoveN(writer, r.end(), count);
+ return writer;
+}
+
+template<typename Range, typename MatchRange>
+typename Range::const_iterator cmRemoveMatching(Range &r, MatchRange const& m)
+{
+ return std::remove_if(r.begin(), r.end(),
+ ContainerAlgorithms::BinarySearcher<MatchRange>(m));
+}
+
+template<typename Range>
+typename Range::const_iterator cmRemoveDuplicates(Range& r)
+{
+ std::vector<typename Range::value_type> unique;
+ unique.reserve(r.size());
+ std::vector<size_t> indices;
+ size_t count = 0;
+ for(typename Range::const_iterator it = r.begin();
+ it != r.end(); ++it, ++count)
+ {
+ typename Range::iterator low =
+ std::lower_bound(unique.begin(), unique.end(), *it);
+ if (low == unique.end() || *low != *it)
+ {
+ unique.insert(low, *it);
+ }
+ else
+ {
+ indices.push_back(count);
+ }
+ }
+ if (indices.empty())
+ {
+ return r.end();
+ }
+ return cmRemoveIndices(r, indices);
+}
+
+#endif
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/cmCommands.h b/Source/cmCommands.h
index c56673f..e902853 100644
--- a/Source/cmCommands.h
+++ b/Source/cmCommands.h
@@ -13,6 +13,8 @@
#define cmCommands_h
#include "cmStandardIncludes.h"
+#include <list>
+
class cmCommand;
/**
* Global function to return all compiled in commands.
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/cmConditionEvaluator.h b/Source/cmConditionEvaluator.h
index 01624f9..fcef234 100644
--- a/Source/cmConditionEvaluator.h
+++ b/Source/cmConditionEvaluator.h
@@ -15,6 +15,8 @@
#include "cmCommand.h"
#include "cmExpandedCommandArgument.h"
+#include <list>
+
class cmConditionEvaluator
{
public:
diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx
index 5b5d6b6..8e20c14 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;
@@ -383,8 +383,8 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
/* Use a random file name to avoid rapid creation and deletion
of the same executable name (some filesystems fail on that). */
- sprintf(targetNameBuf, "cmTryCompileExec%u",
- cmSystemTools::RandomSeed());
+ sprintf(targetNameBuf, "cmTC_%05x",
+ cmSystemTools::RandomSeed() & 0xFFFFF);
targetName = targetNameBuf;
if (!targets.empty())
@@ -685,8 +685,7 @@ void cmCoreTryCompile::FindOutputFile(const std::string& targetName)
command += tmpOutputFile;
if(cmSystemTools::FileExists(command.c_str()))
{
- tmpOutputFile = cmSystemTools::CollapseFullPath(command);
- this->OutputFile = tmpOutputFile;
+ this->OutputFile = cmSystemTools::CollapseFullPath(command);
return;
}
}
diff --git a/Source/cmExportBuildFileGenerator.cxx b/Source/cmExportBuildFileGenerator.cxx
index a28ec48..b1203dd 100644
--- a/Source/cmExportBuildFileGenerator.cxx
+++ b/Source/cmExportBuildFileGenerator.cxx
@@ -68,16 +68,6 @@ bool cmExportBuildFileGenerator::GenerateMainFile(std::ostream& os)
tei != this->Exports.end(); ++tei)
{
cmTarget* te = *tei;
- if (te->GetProperty("INTERFACE_SOURCES"))
- {
- std::ostringstream e;
- e << "Target \""
- << te->GetName()
- << "\" has a populated INTERFACE_SOURCES property. This is not "
- "currently supported.";
- cmSystemTools::Error(e.str().c_str());
- return false;
- }
this->GenerateImportTargetCode(os, te);
te->AppendBuildInterfaceIncludes();
@@ -87,6 +77,9 @@ bool cmExportBuildFileGenerator::GenerateMainFile(std::ostream& os)
this->PopulateInterfaceProperty("INTERFACE_INCLUDE_DIRECTORIES", te,
cmGeneratorExpression::BuildInterface,
properties, missingTargets);
+ this->PopulateInterfaceProperty("INTERFACE_SOURCES", te,
+ cmGeneratorExpression::BuildInterface,
+ properties, missingTargets);
this->PopulateInterfaceProperty("INTERFACE_COMPILE_DEFINITIONS", te,
cmGeneratorExpression::BuildInterface,
properties, missingTargets);
diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx
index af4ce8b..71728be 100644
--- a/Source/cmExportFileGenerator.cxx
+++ b/Source/cmExportFileGenerator.cxx
@@ -224,7 +224,7 @@ static bool isSubDirectory(const char* a, const char* b)
//----------------------------------------------------------------------------
static bool checkInterfaceDirs(const std::string &prepro,
- cmTarget *target)
+ cmTarget *target, const std::string& prop)
{
const char* installDir =
target->GetMakefile()->GetSafeDefinition("CMAKE_INSTALL_PREFIX");
@@ -250,20 +250,27 @@ static bool checkInterfaceDirs(const std::string &prepro,
std::ostringstream e;
if (genexPos != std::string::npos)
{
- switch (target->GetPolicyStatusCMP0041())
+ if (prop == "INTERFACE_INCLUDE_DIRECTORIES")
{
- case cmPolicies::WARN:
- messageType = cmake::WARNING;
- e << target->GetMakefile()->GetPolicies()
- ->GetPolicyWarning(cmPolicies::CMP0041) << "\n";
- break;
- case cmPolicies::OLD:
- continue;
- case cmPolicies::REQUIRED_IF_USED:
- case cmPolicies::REQUIRED_ALWAYS:
- case cmPolicies::NEW:
- hadFatalError = true;
- break; // Issue fatal message.
+ switch (target->GetPolicyStatusCMP0041())
+ {
+ case cmPolicies::WARN:
+ messageType = cmake::WARNING;
+ e << target->GetMakefile()->GetPolicies()
+ ->GetPolicyWarning(cmPolicies::CMP0041) << "\n";
+ break;
+ case cmPolicies::OLD:
+ continue;
+ case cmPolicies::REQUIRED_IF_USED:
+ case cmPolicies::REQUIRED_ALWAYS:
+ case cmPolicies::NEW:
+ hadFatalError = true;
+ break; // Issue fatal message.
+ }
+ }
+ else
+ {
+ hadFatalError = true;
}
}
if (cmHasLiteralPrefix(li->c_str(), "${_IMPORT_PREFIX}"))
@@ -272,8 +279,8 @@ static bool checkInterfaceDirs(const std::string &prepro,
}
if (!cmSystemTools::FileIsFullPath(li->c_str()))
{
- e << "Target \"" << target->GetName() << "\" "
- "INTERFACE_INCLUDE_DIRECTORIES property contains relative path:\n"
+ e << "Target \"" << target->GetName() << "\" " << prop <<
+ " property contains relative path:\n"
" \"" << *li << "\"";
target->GetMakefile()->IssueMessage(messageType, e.str());
}
@@ -289,32 +296,35 @@ static bool checkInterfaceDirs(const std::string &prepro,
(!inBinary || isSubDirectory(installDir, topBinaryDir)) &&
(!inSource || isSubDirectory(installDir, topSourceDir));
- if (!shouldContinue)
+ if (prop == "INTERFACE_INCLUDE_DIRECTORIES")
{
- switch(target->GetPolicyStatusCMP0052())
+ if (!shouldContinue)
{
- case cmPolicies::WARN:
+ switch(target->GetPolicyStatusCMP0052())
{
- std::ostringstream s;
- s << target->GetMakefile()->GetPolicies()
- ->GetPolicyWarning(cmPolicies::CMP0052) << "\n";
- s << "Directory:\n \"" << *li << "\"\nin "
- "INTERFACE_INCLUDE_DIRECTORIES of target \""
- << target->GetName() << "\" is a subdirectory of the install "
- "directory:\n \"" << installDir << "\"\nhowever it is also "
- "a subdirectory of the " << (inBinary ? "build" : "source")
- << " tree:\n \"" << (inBinary ? topBinaryDir : topSourceDir)
- << "\"" << std::endl;
- target->GetMakefile()->IssueMessage(cmake::AUTHOR_WARNING,
- s.str());
+ case cmPolicies::WARN:
+ {
+ std::ostringstream s;
+ s << target->GetMakefile()->GetPolicies()
+ ->GetPolicyWarning(cmPolicies::CMP0052) << "\n";
+ s << "Directory:\n \"" << *li << "\"\nin "
+ "INTERFACE_INCLUDE_DIRECTORIES of target \""
+ << target->GetName() << "\" is a subdirectory of the install "
+ "directory:\n \"" << installDir << "\"\nhowever it is also "
+ "a subdirectory of the " << (inBinary ? "build" : "source")
+ << " tree:\n \"" << (inBinary ? topBinaryDir : topSourceDir)
+ << "\"" << std::endl;
+ target->GetMakefile()->IssueMessage(cmake::AUTHOR_WARNING,
+ s.str());
+ }
+ case cmPolicies::OLD:
+ shouldContinue = true;
+ break;
+ case cmPolicies::REQUIRED_ALWAYS:
+ case cmPolicies::REQUIRED_IF_USED:
+ case cmPolicies::NEW:
+ break;
}
- case cmPolicies::OLD:
- shouldContinue = true;
- break;
- case cmPolicies::REQUIRED_ALWAYS:
- case cmPolicies::REQUIRED_IF_USED:
- case cmPolicies::NEW:
- break;
}
}
if (shouldContinue)
@@ -324,8 +334,8 @@ static bool checkInterfaceDirs(const std::string &prepro,
}
if (inBinary)
{
- e << "Target \"" << target->GetName() << "\" "
- "INTERFACE_INCLUDE_DIRECTORIES property contains path:\n"
+ e << "Target \"" << target->GetName() << "\" " << prop <<
+ " property contains path:\n"
" \"" << *li << "\"\nwhich is prefixed in the build directory.";
target->GetMakefile()->IssueMessage(messageType, e.str());
}
@@ -333,8 +343,8 @@ static bool checkInterfaceDirs(const std::string &prepro,
{
if (inSource)
{
- e << "Target \"" << target->GetName() << "\" "
- "INTERFACE_INCLUDE_DIRECTORIES property contains path:\n"
+ e << "Target \"" << target->GetName() << "\" " << prop <<
+ " property contains path:\n"
" \"" << *li << "\"\nwhich is prefixed in the source directory.";
target->GetMakefile()->IssueMessage(messageType, e.str());
}
@@ -365,6 +375,46 @@ static void prefixItems(std::string &exportDirs)
}
//----------------------------------------------------------------------------
+void cmExportFileGenerator::PopulateSourcesInterface(
+ cmTargetExport *tei,
+ cmGeneratorExpression::PreprocessContext preprocessRule,
+ ImportPropertyMap &properties,
+ std::vector<std::string> &missingTargets)
+{
+ cmTarget *target = tei->Target;
+ assert(preprocessRule == cmGeneratorExpression::InstallInterface);
+
+ const char *propName = "INTERFACE_SOURCES";
+ const char *input = target->GetProperty(propName);
+
+ if (!input)
+ {
+ return;
+ }
+
+ if (!*input)
+ {
+ properties[propName] = "";
+ return;
+ }
+
+ std::string prepro = cmGeneratorExpression::Preprocess(input,
+ preprocessRule,
+ true);
+ if (!prepro.empty())
+ {
+ this->ResolveTargetsInGeneratorExpressions(prepro, target,
+ missingTargets);
+
+ if (!checkInterfaceDirs(prepro, target, propName))
+ {
+ return;
+ }
+ properties[propName] = prepro;
+ }
+}
+
+//----------------------------------------------------------------------------
void cmExportFileGenerator::PopulateIncludeDirectoriesInterface(
cmTargetExport *tei,
cmGeneratorExpression::PreprocessContext preprocessRule,
@@ -424,7 +474,7 @@ void cmExportFileGenerator::PopulateIncludeDirectoriesInterface(
this->ResolveTargetsInGeneratorExpressions(prepro, target,
missingTargets);
- if (!checkInterfaceDirs(prepro, target))
+ if (!checkInterfaceDirs(prepro, target, propName))
{
return;
}
diff --git a/Source/cmExportFileGenerator.h b/Source/cmExportFileGenerator.h
index 919924e..b6f4166 100644
--- a/Source/cmExportFileGenerator.h
+++ b/Source/cmExportFileGenerator.h
@@ -139,6 +139,11 @@ protected:
cmGeneratorExpression::PreprocessContext preprocessRule,
ImportPropertyMap &properties,
std::vector<std::string> &missingTargets);
+ void PopulateSourcesInterface(
+ cmTargetExport *target,
+ cmGeneratorExpression::PreprocessContext preprocessRule,
+ ImportPropertyMap &properties,
+ std::vector<std::string> &missingTargets);
void SetImportLinkInterface(const std::string& config,
std::string const& suffix,
diff --git a/Source/cmExportInstallFileGenerator.cxx b/Source/cmExportInstallFileGenerator.cxx
index 98ed818..ba1dde2 100644
--- a/Source/cmExportInstallFileGenerator.cxx
+++ b/Source/cmExportInstallFileGenerator.cxx
@@ -73,8 +73,8 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os)
// to reference if they are relative to the install prefix.
std::string installPrefix =
this->IEGen->GetMakefile()->GetSafeDefinition("CMAKE_INSTALL_PREFIX");
- const char* installDest = this->IEGen->GetDestination();
- if(cmSystemTools::FileIsFullPath(installDest))
+ std::string const& expDest = this->IEGen->GetDestination();
+ if(cmSystemTools::FileIsFullPath(expDest))
{
// The export file is being installed to an absolute path so the
// package is not relocatable. Use the configured install prefix.
@@ -87,7 +87,7 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os)
{
// Add code to compute the installation prefix relative to the
// import file location.
- std::string absDest = installPrefix + "/" + installDest;
+ std::string absDest = installPrefix + "/" + expDest;
std::string absDestS = absDest + "/";
os << "# Compute the installation prefix relative to this file.\n"
<< "get_filename_component(_IMPORT_PREFIX"
@@ -109,7 +109,7 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os)
"unset(_realOrig)\n"
"unset(_realCurr)\n";
}
- std::string dest = installDest;
+ std::string dest = expDest;
while(!dest.empty())
{
os <<
@@ -123,6 +123,7 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os)
bool require2_8_12 = false;
bool require3_0_0 = false;
+ bool require3_1_0 = false;
bool requiresConfigFiles = false;
// Create all the imported targets.
for(std::vector<cmTargetExport*>::const_iterator
@@ -131,17 +132,6 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os)
{
cmTarget* te = (*tei)->Target;
- if (te->GetProperty("INTERFACE_SOURCES"))
- {
- std::ostringstream e;
- e << "Target \""
- << te->GetName()
- << "\" has a populated INTERFACE_SOURCES property. This is not "
- "currently supported.";
- cmSystemTools::Error(e.str().c_str());
- return false;
- }
-
requiresConfigFiles = requiresConfigFiles
|| te->GetType() != cmTarget::INTERFACE_LIBRARY;
@@ -152,6 +142,9 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os)
this->PopulateIncludeDirectoriesInterface(*tei,
cmGeneratorExpression::InstallInterface,
properties, missingTargets);
+ this->PopulateSourcesInterface(*tei,
+ cmGeneratorExpression::InstallInterface,
+ properties, missingTargets);
this->PopulateInterfaceProperty("INTERFACE_SYSTEM_INCLUDE_DIRECTORIES",
te,
cmGeneratorExpression::InstallInterface,
@@ -190,6 +183,13 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os)
{
require3_0_0 = true;
}
+ if(te->GetProperty("INTERFACE_SOURCES"))
+ {
+ // We can only generate INTERFACE_SOURCES in CMake 3.3, but CMake 3.1
+ // can consume them.
+ require3_1_0 = true;
+ }
+
this->PopulateInterfaceProperty("INTERFACE_POSITION_INDEPENDENT_CODE",
te, properties);
this->PopulateCompatibleInterfaceProperties(te, properties);
@@ -197,7 +197,11 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os)
this->GenerateInterfaceProperties(te, os, properties);
}
- if (require3_0_0)
+ if (require3_1_0)
+ {
+ this->GenerateRequiredCMakeVersion(os, "3.1.0");
+ }
+ else if (require3_0_0)
{
this->GenerateRequiredCMakeVersion(os, "3.0.0");
}
@@ -394,7 +398,7 @@ cmExportInstallFileGenerator
cmTarget* target = itgen->GetTarget();
// Construct the installed location of the target.
- std::string dest = itgen->GetDestination();
+ std::string dest = itgen->GetDestination(config);
std::string value;
if(!cmSystemTools::FileIsFullPath(dest.c_str()))
{
diff --git a/Source/cmExportSet.cxx b/Source/cmExportSet.cxx
index 14812e4..4148fb5 100644
--- a/Source/cmExportSet.cxx
+++ b/Source/cmExportSet.cxx
@@ -12,6 +12,7 @@
#include "cmExportSet.h"
#include "cmTargetExport.h"
+#include "cmAlgorithms.h"
cmExportSet::~cmExportSet()
{
diff --git a/Source/cmExportSetMap.cxx b/Source/cmExportSetMap.cxx
index 14c4458..cf431c6 100644
--- a/Source/cmExportSetMap.cxx
+++ b/Source/cmExportSetMap.cxx
@@ -12,6 +12,7 @@
#include "cmExportSetMap.h"
#include "cmExportSet.h"
+#include "cmAlgorithms.h"
cmExportSet* cmExportSetMap::operator[](const std::string &name)
{
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..212603c 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,
@@ -217,7 +217,6 @@ bool cmFileCommand
bool cmFileCommand::HandleWriteCommand(std::vector<std::string> const& args,
bool append)
{
- std::string message;
std::vector<std::string>::const_iterator i = args.begin();
i++; // Get rid of subcommand
@@ -231,10 +230,6 @@ bool cmFileCommand::HandleWriteCommand(std::vector<std::string> const& args,
i++;
- for(;i != args.end(); ++i)
- {
- message += *i;
- }
if ( !this->Makefile->CanIWriteThisFile(fileName.c_str()) )
{
std::string e
@@ -272,6 +267,7 @@ bool cmFileCommand::HandleWriteCommand(std::vector<std::string> const& args,
this->SetError(error);
return false;
}
+ std::string message = cmJoin(cmRange(i, args.end()), std::string());
file << message;
file.close();
if(mode)
@@ -1843,7 +1839,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/cmFileLockPool.cxx b/Source/cmFileLockPool.cxx
index cf8e9a9..3710eb0 100644
--- a/Source/cmFileLockPool.cxx
+++ b/Source/cmFileLockPool.cxx
@@ -16,6 +16,7 @@
#include "cmFileLock.h"
#include "cmFileLockResult.h"
+#include "cmAlgorithms.h"
cmFileLockPool::cmFileLockPool()
{
diff --git a/Source/cmFileLockPool.h b/Source/cmFileLockPool.h
index baef310..f0614a3 100644
--- a/Source/cmFileLockPool.h
+++ b/Source/cmFileLockPool.h
@@ -14,6 +14,8 @@
#include "cmStandardIncludes.h"
+#include <list>
+
class cmFileLockResult;
class cmFileLock;
diff --git a/Source/cmFindBase.cxx b/Source/cmFindBase.cxx
index 69991d5..6e55533 100644
--- a/Source/cmFindBase.cxx
+++ b/Source/cmFindBase.cxx
@@ -166,11 +166,9 @@ bool cmFindBase::ParseArguments(std::vector<std::string> const& argsIn)
}
else
{
- this->VariableDocumentation += "one of the " + this->Names[0];
- for (unsigned int j = 1; j < this->Names.size() - 1; ++j)
- {
- this->VariableDocumentation += ", " + this->Names[j];
- }
+ this->VariableDocumentation += "one of the ";
+ this->VariableDocumentation += cmJoin(cmRange(this->Names).retreat(1),
+ ", ");
this->VariableDocumentation += " or "
+ this->Names[this->Names.size() - 1] + " libraries be found";
}
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/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx
index 7746980..fd9b236 100644
--- a/Source/cmFindPackageCommand.cxx
+++ b/Source/cmFindPackageCommand.cxx
@@ -1064,26 +1064,11 @@ void cmFindPackageCommand::AppendToFoundProperty(bool found)
}
- std::string tmp;
- const char* sep ="";
- for(size_t i=0; i<foundContents.size(); i++)
- {
- tmp += sep;
- tmp += foundContents[i];
- sep = ";";
- }
-
+ std::string tmp = cmJoin(foundContents, ";");
this->Makefile->GetCMakeInstance()->SetProperty("PACKAGES_FOUND",
tmp.c_str());
- tmp = "";
- sep = "";
- for(size_t i=0; i<notFoundContents.size(); i++)
- {
- tmp += sep;
- tmp += notFoundContents[i];
- sep = ";";
- }
+ tmp = cmJoin(notFoundContents, ";");
this->Makefile->GetCMakeInstance()->SetProperty("PACKAGES_NOT_FOUND",
tmp.c_str());
}
diff --git a/Source/cmFunctionCommand.cxx b/Source/cmFunctionCommand.cxx
index c33048c..a4d9357 100644
--- a/Source/cmFunctionCommand.cxx
+++ b/Source/cmFunctionCommand.cxx
@@ -126,27 +126,10 @@ bool cmFunctionHelperCommand::InvokeInitialPass
}
// define ARGV and ARGN
- std::vector<std::string>::const_iterator eit;
- std::string argvDef;
- std::string argnDef;
- unsigned int cnt = 0;
- for ( eit = expandedArgs.begin(); eit != expandedArgs.end(); ++eit )
- {
- if (!argvDef.empty())
- {
- argvDef += ";";
- }
- argvDef += *eit;
- if ( cnt >= this->Args.size()-1 )
- {
- if (!argnDef.empty())
- {
- argnDef += ";";
- }
- argnDef += *eit;
- }
- cnt ++;
- }
+ std::string argvDef = cmJoin(expandedArgs, ";");
+ std::vector<std::string>::const_iterator eit
+ = expandedArgs.begin() + (this->Args.size()-1);
+ std::string argnDef = cmJoin(cmRange(eit, expandedArgs.end()), ";");
this->Makefile->AddDefinition("ARGV", argvDef.c_str());
this->Makefile->MarkVariableAsUsed("ARGV");
this->Makefile->AddDefinition("ARGN", argnDef.c_str());
@@ -193,12 +176,8 @@ IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf,
if (!this->Depth)
{
std::string name = this->Args[0];
- std::vector<std::string>::size_type cc;
- name += "(";
- for ( cc = 0; cc < this->Args.size(); cc ++ )
- {
- name += " " + this->Args[cc];
- }
+ name += "( ";
+ name += cmJoin(this->Args, " ");
name += " )";
// create a new command and add it to cmake
diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx
index 6692a92..ba18faa 100644
--- a/Source/cmGeneratorExpressionEvaluator.cxx
+++ b/Source/cmGeneratorExpressionEvaluator.cxx
@@ -24,10 +24,7 @@
#include <errno.h>
//----------------------------------------------------------------------------
-#if !defined(__SUNPRO_CC) || __SUNPRO_CC > 0x510
-static
-#endif
-void reportError(cmGeneratorExpressionContext *context,
+static void reportError(cmGeneratorExpressionContext *context,
const std::string &expr, const std::string &result)
{
context->HadError = true;
diff --git a/Source/cmGetCMakePropertyCommand.cxx b/Source/cmGetCMakePropertyCommand.cxx
index e193cf5..84c00ba 100644
--- a/Source/cmGetCMakePropertyCommand.cxx
+++ b/Source/cmGetCMakePropertyCommand.cxx
@@ -25,7 +25,6 @@ bool cmGetCMakePropertyCommand
return false;
}
- std::vector<std::string>::size_type cc;
std::string variable = args[0];
std::string output = "NOTFOUND";
@@ -35,12 +34,7 @@ bool cmGetCMakePropertyCommand
std::vector<std::string> vars = this->Makefile->GetDefinitions(cacheonly);
if (!vars.empty())
{
- output = vars[0];
- }
- for ( cc = 1; cc < vars.size(); ++cc )
- {
- output += ";";
- output += vars[cc];
+ output = cmJoin(vars, ";");
}
}
else if ( args[1] == "MACROS" )
@@ -52,16 +46,7 @@ bool cmGetCMakePropertyCommand
const std::set<std::string>* components
= this->Makefile->GetLocalGenerator()->GetGlobalGenerator()
->GetInstallComponents();
- std::set<std::string>::const_iterator compIt;
- output = "";
- for (compIt = components->begin(); compIt != components->end(); ++compIt)
- {
- if (compIt != components->begin())
- {
- output += ";";
- }
- output += *compIt;
- }
+ output = cmJoin(*components, ";");
}
else
{
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 6d0fedc..1de4a59 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -74,11 +74,7 @@ cmGlobalGenerator::cmGlobalGenerator()
cmGlobalGenerator::~cmGlobalGenerator()
{
this->ClearGeneratorMembers();
-
- if (this->ExtraGenerator)
- {
- delete this->ExtraGenerator;
- }
+ delete this->ExtraGenerator;
}
bool cmGlobalGenerator::SetGeneratorPlatform(std::string const& p,
@@ -1391,7 +1387,7 @@ void cmGlobalGenerator::CreateQtAutoGeneratorsTargets(AutogensType &autogens)
cmQtAutoGenerators autogen;
if(autogen.InitializeAutogenTarget(&target))
{
- autogens.push_back(AutogensType::value_type(autogen, &target));
+ autogens.push_back(std::make_pair(autogen, &target));
}
}
}
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/cmGlobalVisualStudio7Generator.h b/Source/cmGlobalVisualStudio7Generator.h
index 201a6a6..b591653 100644
--- a/Source/cmGlobalVisualStudio7Generator.h
+++ b/Source/cmGlobalVisualStudio7Generator.h
@@ -94,7 +94,8 @@ public:
std::string& dir);
///! What is the configurations directory variable called?
- virtual const char* GetCMakeCFGIntDir() const { return "$(OutDir)"; }
+ virtual const char* GetCMakeCFGIntDir() const
+ { return "$(ConfigurationName)"; }
/** Return true if the target project file should have the option
LinkLibraryDependencies and link to .sln dependencies. */
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index cd0dcc6..aea134e 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.
@@ -2433,8 +2436,11 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
if (!attribute.empty())
{
+ cmGeneratorExpression ge;
+ std::string processed = ge.Parse(i->second.GetValue())
+ ->Evaluate(this->CurrentMakefile, configName);
buildSettings->AddAttribute(attribute.c_str(),
- this->CreateString(i->second.GetValue()));
+ this->CreateString(processed));
}
}
}
diff --git a/Source/cmInstallDirectoryGenerator.cxx b/Source/cmInstallDirectoryGenerator.cxx
index 8c13bab..7593380 100644
--- a/Source/cmInstallDirectoryGenerator.cxx
+++ b/Source/cmInstallDirectoryGenerator.cxx
@@ -44,7 +44,9 @@ cmInstallDirectoryGenerator::GenerateScriptActions(std::ostream& os,
{
// Write code to install the directories.
const char* no_rename = 0;
- this->AddInstallRule(os, cmInstallType_DIRECTORY,
+ this->AddInstallRule(os,
+ this->Destination,
+ cmInstallType_DIRECTORY,
this->Directories,
this->Optional,
this->FilePermissions.c_str(),
diff --git a/Source/cmInstallExportGenerator.cxx b/Source/cmInstallExportGenerator.cxx
index 4480cc6..38c80df 100644
--- a/Source/cmInstallExportGenerator.cxx
+++ b/Source/cmInstallExportGenerator.cxx
@@ -185,7 +185,8 @@ cmInstallExportGenerator::GenerateScriptConfigs(std::ostream& os,
files.push_back(i->second);
std::string config_test = this->CreateConfigTest(i->first);
os << indent << "if(" << config_test << ")\n";
- this->AddInstallRule(os, cmInstallType_FILES, files, false,
+ this->AddInstallRule(os, this->Destination,
+ cmInstallType_FILES, files, false,
this->FilePermissions.c_str(), 0, 0, 0,
indent.Next());
os << indent << "endif()\n";
@@ -199,7 +200,7 @@ void cmInstallExportGenerator::GenerateScriptActions(std::ostream& os,
{
// Remove old per-configuration export files if the main changes.
std::string installedDir = "$ENV{DESTDIR}";
- installedDir += this->GetInstallDestination();
+ installedDir += this->ConvertToAbsoluteDestination(this->Destination);
installedDir += "/";
std::string installedFile = installedDir;
installedFile += this->FileName;
@@ -224,6 +225,7 @@ void cmInstallExportGenerator::GenerateScriptActions(std::ostream& os,
// Install the main export file.
std::vector<std::string> files;
files.push_back(this->MainImportFile);
- this->AddInstallRule(os, cmInstallType_FILES, files, false,
+ this->AddInstallRule(os, this->Destination,
+ cmInstallType_FILES, files, false,
this->FilePermissions.c_str(), 0, 0, 0, indent);
}
diff --git a/Source/cmInstallExportGenerator.h b/Source/cmInstallExportGenerator.h
index eb8c28b..3e078f2 100644
--- a/Source/cmInstallExportGenerator.h
+++ b/Source/cmInstallExportGenerator.h
@@ -41,6 +41,9 @@ public:
const std::string& GetNamespace() const { return this->Namespace; }
+ std::string const& GetDestination() const
+ { return this->Destination; }
+
protected:
virtual void GenerateScript(std::ostream& os);
virtual void GenerateScriptConfigs(std::ostream& os, Indent const& indent);
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/cmInstallFilesGenerator.cxx b/Source/cmInstallFilesGenerator.cxx
index 91b102a..28c27c2 100644
--- a/Source/cmInstallFilesGenerator.cxx
+++ b/Source/cmInstallFilesGenerator.cxx
@@ -57,6 +57,7 @@ void cmInstallFilesGenerator::AddFilesInstallRule(
// Write code to install the files.
const char* no_dir_permissions = 0;
this->AddInstallRule(os,
+ this->Destination,
(this->Programs
? cmInstallType_PROGRAMS
: cmInstallType_FILES),
diff --git a/Source/cmInstallGenerator.cxx b/Source/cmInstallGenerator.cxx
index b261cbf..2e1c5f0 100644
--- a/Source/cmInstallGenerator.cxx
+++ b/Source/cmInstallGenerator.cxx
@@ -37,6 +37,7 @@ cmInstallGenerator
void cmInstallGenerator
::AddInstallRule(
std::ostream& os,
+ std::string const& dest,
cmInstallType type,
std::vector<std::string> const& files,
bool optional /* = false */,
@@ -60,7 +61,6 @@ void cmInstallGenerator
case cmInstallType_FILES: stype = "FILE"; break;
}
os << indent;
- std::string dest = this->GetInstallDestination();
if (cmSystemTools::FileIsFullPath(dest.c_str()))
{
os << "list(APPEND CMAKE_ABSOLUTE_DESTINATION_FILES\n";
@@ -94,7 +94,8 @@ void cmInstallGenerator
<< "${CMAKE_ABSOLUTE_DESTINATION_FILES}\")\n";
os << indent << "endif()\n";
}
- os << "file(INSTALL DESTINATION \"" << dest << "\" TYPE " << stype;
+ std::string absDest = this->ConvertToAbsoluteDestination(dest);
+ os << "file(INSTALL DESTINATION \"" << absDest << "\" TYPE " << stype;
if(optional)
{
os << " OPTIONAL";
@@ -179,15 +180,16 @@ bool cmInstallGenerator::InstallsForConfig(const std::string& config)
}
//----------------------------------------------------------------------------
-std::string cmInstallGenerator::GetInstallDestination() const
+std::string
+cmInstallGenerator::ConvertToAbsoluteDestination(std::string const& dest) const
{
std::string result;
- if(!this->Destination.empty() &&
- !cmSystemTools::FileIsFullPath(this->Destination.c_str()))
+ if(!dest.empty() &&
+ !cmSystemTools::FileIsFullPath(dest.c_str()))
{
result = "${CMAKE_INSTALL_PREFIX}/";
}
- result += this->Destination;
+ result += dest;
return result;
}
diff --git a/Source/cmInstallGenerator.h b/Source/cmInstallGenerator.h
index 38aac91..c4191e4 100644
--- a/Source/cmInstallGenerator.h
+++ b/Source/cmInstallGenerator.h
@@ -40,7 +40,9 @@ public:
virtual ~cmInstallGenerator();
void AddInstallRule(
- std::ostream& os, cmInstallType type,
+ std::ostream& os,
+ std::string const& dest,
+ cmInstallType type,
std::vector<std::string> const& files,
bool optional = false,
const char* permissions_file = 0,
@@ -50,12 +52,9 @@ public:
Indent const& indent = Indent()
);
- const char* GetDestination() const
- { return this->Destination.c_str(); }
-
/** Get the install destination as it should appear in the
installation script. */
- std::string GetInstallDestination() const;
+ std::string ConvertToAbsoluteDestination(std::string const& dest) const;
/** Test if this generator installs something for a given configuration. */
bool InstallsForConfig(const std::string& config);
diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx
index 6d69f54..b035bad 100644
--- a/Source/cmInstallTargetGenerator.cxx
+++ b/Source/cmInstallTargetGenerator.cxx
@@ -12,6 +12,7 @@
#include "cmInstallTargetGenerator.h"
#include "cmComputeLinkInformation.h"
+#include "cmGeneratorExpression.h"
#include "cmGlobalGenerator.h"
#include "cmLocalGenerator.h"
#include "cmMakefile.h"
@@ -77,7 +78,8 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(std::ostream& os,
fromDirConfig = this->Target->GetDirectory(config, this->ImportLibrary);
fromDirConfig += "/";
}
- std::string toDir = this->GetInstallDestination();
+ std::string toDir =
+ this->ConvertToAbsoluteDestination(this->GetDestination(config));
toDir += "/";
// Compute the list of files to install for this target.
@@ -322,8 +324,8 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(std::ostream& os,
const char* no_dir_permissions = 0;
const char* no_rename = 0;
bool optional = this->Optional || this->ImportLibrary;
- this->AddInstallRule(os, type, filesFrom,
- optional,
+ this->AddInstallRule(os, this->GetDestination(config),
+ type, filesFrom, optional,
this->FilePermissions.c_str(), no_dir_permissions,
no_rename, literal_args.c_str(),
indent);
@@ -335,6 +337,15 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(std::ostream& os,
//----------------------------------------------------------------------------
std::string
+cmInstallTargetGenerator::GetDestination(std::string const& config) const
+{
+ cmGeneratorExpression ge;
+ return ge.Parse(this->Destination)
+ ->Evaluate(this->Target->GetMakefile(), config);
+}
+
+//----------------------------------------------------------------------------
+std::string
cmInstallTargetGenerator::GetInstallFilename(const std::string& config) const
{
NameType nameType = this->ImportLibrary? NameImplib : NameNormal;
diff --git a/Source/cmInstallTargetGenerator.h b/Source/cmInstallTargetGenerator.h
index 7e5cc71..075c8a4 100644
--- a/Source/cmInstallTargetGenerator.h
+++ b/Source/cmInstallTargetGenerator.h
@@ -60,6 +60,8 @@ public:
cmTarget* GetTarget() const { return this->Target; }
bool IsImportLibrary() const { return this->ImportLibrary; }
+ std::string GetDestination(std::string const& config) const;
+
protected:
virtual void GenerateScript(std::ostream& os);
virtual void GenerateScriptForConfig(std::ostream& os,
diff --git a/Source/cmInstalledFile.h b/Source/cmInstalledFile.h
index 503f92c..cdb0866 100644
--- a/Source/cmInstalledFile.h
+++ b/Source/cmInstalledFile.h
@@ -13,6 +13,7 @@
#define cmInstalledFile_h
#include "cmGeneratorExpression.h"
+#include "cmAlgorithms.h"
/** \class cmInstalledFile
* \brief Represents a file intended for installation.
diff --git a/Source/cmListCommand.cxx b/Source/cmListCommand.cxx
index 107dca9..0c6adfd 100644
--- a/Source/cmListCommand.cxx
+++ b/Source/cmListCommand.cxx
@@ -104,19 +104,8 @@ bool cmListCommand::GetList(std::vector<std::string>& list,
}
// expand the variable into a list
cmSystemTools::ExpandListArgument(listString, list, true);
- // check the list for empty values
- bool hasEmpty = false;
- for(std::vector<std::string>::iterator i = list.begin();
- i != list.end(); ++i)
- {
- if(i->empty())
- {
- hasEmpty = true;
- break;
- }
- }
// if no empty elements then just return
- if(!hasEmpty)
+ if (std::find(list.begin(), list.end(), std::string()) == list.end())
{
return true;
}
@@ -213,12 +202,12 @@ bool cmListCommand::HandleGetCommand(std::vector<std::string> const& args)
std::string value;
size_t cc;
const char* sep = "";
+ size_t nitem = varArgsExpanded.size();
for ( cc = 2; cc < args.size()-1; cc ++ )
{
int item = atoi(args[cc].c_str());
value += sep;
sep = ";";
- size_t nitem = varArgsExpanded.size();
if ( item < 0 )
{
item = (int)nitem + item;
@@ -227,8 +216,8 @@ bool cmListCommand::HandleGetCommand(std::vector<std::string> const& args)
{
std::ostringstream str;
str << "index: " << item << " out of range (-"
- << varArgsExpanded.size() << ", "
- << varArgsExpanded.size()-1 << ")";
+ << nitem << ", "
+ << nitem - 1 << ")";
this->SetError(str.str());
return false;
}
@@ -254,15 +243,12 @@ bool cmListCommand::HandleAppendCommand(std::vector<std::string> const& args)
// expand the variable
std::string listString;
this->GetListString(listString, listName);
- size_t cc;
- for ( cc = 2; cc < args.size(); ++ cc )
+
+ if(!listString.empty() && !args.empty())
{
- if(!listString.empty())
- {
- listString += ";";
- }
- listString += args[cc];
+ listString += ";";
}
+ listString += cmJoin(cmRange(args).advance(2), ";");
this->Makefile->AddDefinition(listName, listString.c_str());
return true;
@@ -287,18 +273,14 @@ bool cmListCommand::HandleFindCommand(std::vector<std::string> const& args)
return true;
}
- std::vector<std::string>::iterator it;
- unsigned int index = 0;
- for ( it = varArgsExpanded.begin(); it != varArgsExpanded.end(); ++ it )
+ std::vector<std::string>::iterator it =
+ std::find(varArgsExpanded.begin(), varArgsExpanded.end(), args[2]);
+ if (it != varArgsExpanded.end())
{
- if ( *it == args[2] )
- {
- char indexString[32];
- sprintf(indexString, "%d", index);
- this->Makefile->AddDefinition(variableName, indexString);
- return true;
- }
- index++;
+ std::ostringstream indexStream;
+ indexStream << std::distance(varArgsExpanded.begin(), it);
+ this->Makefile->AddDefinition(variableName, indexStream.str().c_str());
+ return true;
}
this->Makefile->AddDefinition(variableName, "-1");
@@ -373,25 +355,16 @@ bool cmListCommand
return false;
}
- size_t cc;
- for ( cc = 2; cc < args.size(); ++ cc )
- {
- size_t kk = 0;
- while ( kk < varArgsExpanded.size() )
- {
- if ( varArgsExpanded[kk] == args[cc] )
- {
- varArgsExpanded.erase(varArgsExpanded.begin()+kk);
- }
- else
- {
- kk ++;
- }
- }
- }
-
+ std::vector<std::string> remove(args.begin() + 2, args.end());
+ std::sort(remove.begin(), remove.end());
+ std::vector<std::string>::const_iterator remEnd =
+ std::unique(remove.begin(), remove.end());
+ std::vector<std::string>::const_iterator remBegin = remove.begin();
- std::string value = cmJoin(varArgsExpanded, ";");
+ std::vector<std::string>::const_iterator argsEnd =
+ cmRemoveMatching(varArgsExpanded, cmRange(remBegin, remEnd));
+ std::vector<std::string>::const_iterator argsBegin = varArgsExpanded.begin();
+ std::string value = cmJoin(cmRange(argsBegin, argsEnd), ";");
this->Makefile->AddDefinition(listName, value.c_str());
return true;
}
@@ -417,15 +390,8 @@ bool cmListCommand
return false;
}
- std::string value;
- std::vector<std::string>::reverse_iterator it;
- const char* sep = "";
- for ( it = varArgsExpanded.rbegin(); it != varArgsExpanded.rend(); ++ it )
- {
- value += sep;
- value += it->c_str();
- sep = ";";
- }
+ std::reverse(varArgsExpanded.begin(), varArgsExpanded.end());
+ std::string value = cmJoin(varArgsExpanded, ";");
this->Makefile->AddDefinition(listName, value.c_str());
return true;
@@ -453,24 +419,11 @@ bool cmListCommand
return false;
}
- std::string value;
-
-
- std::set<std::string> unique;
- std::vector<std::string>::iterator it;
- const char* sep = "";
- for ( it = varArgsExpanded.begin(); it != varArgsExpanded.end(); ++ it )
- {
- if (unique.find(*it) != unique.end())
- {
- continue;
- }
- unique.insert(*it);
- value += sep;
- value += it->c_str();
- sep = ";";
- }
-
+ std::vector<std::string>::const_iterator argsEnd =
+ cmRemoveDuplicates(varArgsExpanded);
+ std::vector<std::string>::const_iterator argsBegin =
+ varArgsExpanded.begin();
+ std::string value = cmJoin(cmRange(argsBegin, argsEnd), ";");
this->Makefile->AddDefinition(listName, value.c_str());
return true;
@@ -532,10 +485,10 @@ bool cmListCommand::HandleRemoveAtCommand(
size_t cc;
std::vector<size_t> removed;
+ size_t nitem = varArgsExpanded.size();
for ( cc = 2; cc < args.size(); ++ cc )
{
int item = atoi(args[cc].c_str());
- size_t nitem = varArgsExpanded.size();
if ( item < 0 )
{
item = (int)nitem + item;
@@ -544,35 +497,23 @@ bool cmListCommand::HandleRemoveAtCommand(
{
std::ostringstream str;
str << "index: " << item << " out of range (-"
- << varArgsExpanded.size() << ", "
- << varArgsExpanded.size()-1 << ")";
+ << nitem << ", "
+ << nitem - 1 << ")";
this->SetError(str.str());
return false;
}
removed.push_back(static_cast<size_t>(item));
}
- std::string value;
- const char* sep = "";
- for ( cc = 0; cc < varArgsExpanded.size(); ++ cc )
- {
- size_t kk;
- bool found = false;
- for ( kk = 0; kk < removed.size(); ++ kk )
- {
- if ( cc == removed[kk] )
- {
- found = true;
- }
- }
+ std::sort(removed.begin(), removed.end());
+ std::vector<size_t>::const_iterator remEnd =
+ std::unique(removed.begin(), removed.end());
+ std::vector<size_t>::const_iterator remBegin = removed.begin();
- if ( !found )
- {
- value += sep;
- value += varArgsExpanded[cc];
- sep = ";";
- }
- }
+ std::vector<std::string>::const_iterator argsEnd =
+ cmRemoveIndices(varArgsExpanded, cmRange(remBegin, remEnd));
+ std::vector<std::string>::const_iterator argsBegin = varArgsExpanded.begin();
+ std::string value = cmJoin(cmRange(argsBegin, argsEnd), ";");
this->Makefile->AddDefinition(listName, value.c_str());
return true;
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 7ca7684..6a6135b 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -1952,14 +1952,13 @@ void cmLocalGenerator::OutputLinkLibraries(std::string& linkLibraries,
// Write the library flags to the build rule.
fout << linkLibs;
- // Get the RPATH entries.
- std::vector<std::string> runtimeDirs;
- cli.GetRPath(runtimeDirs, relink);
-
// Check what kind of rpath flags to use.
if(cli.GetRuntimeSep().empty())
{
// Each rpath entry gets its own option ("-R a -R b -R c")
+ std::vector<std::string> runtimeDirs;
+ cli.GetRPath(runtimeDirs, relink);
+
std::string rpath;
for(std::vector<std::string>::iterator ri = runtimeDirs.begin();
ri != runtimeDirs.end(); ++ri)
@@ -3011,14 +3010,12 @@ cmLocalGenerator::ConvertToRelativePath(const std::vector<std::string>& local,
// trailing slash in the input then the last iteration of the loop
// will add a slash followed by an empty string which will preserve
// the trailing slash in the output.
- for(unsigned int i=common; i < remote.size(); ++i)
+
+ if(!relative.empty() && !remote.empty())
{
- if(!relative.empty())
- {
- relative += "/";
- }
- relative += remote[i];
+ relative += "/";
}
+ relative += cmJoin(cmRange(remote).advance(common), "/");
// Finally return the path.
return relative;
@@ -3204,11 +3201,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 +3638,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 dfa6cc9..c275e6b 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);
}
@@ -2288,21 +2295,19 @@ cmLocalUnixMakefileGenerator3::ConvertToQuotedOutputPath(const char* p,
// Begin the quoted result with the root component.
result += components[0];
- // Now add the rest of the components separated by the proper slash
- // direction for this platform.
- bool first = true;
- for(unsigned int i=1; i < components.size(); ++i)
+ if (components.size() > 1)
{
+ // Now add the rest of the components separated by the proper slash
+ // direction for this platform.
+ std::vector<std::string>::const_iterator compEnd
+ = std::remove(components.begin() + 1, components.end() - 1,
+ std::string());
+ std::vector<std::string>::const_iterator compStart
+ = components.begin() + 1;
+ result += cmJoin(cmRange(compStart, compEnd), slash);
// Only the last component can be empty to avoid double slashes.
- if(!components[i].empty() || (i == (components.size()-1)))
- {
- if(!first)
- {
- result += slash;
- }
- result += components[i];
- first = false;
- }
+ result += slash;
+ result += components.back();
}
}
@@ -2393,14 +2398,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/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index 914df5f..ed560aa 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -669,8 +669,7 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout,
static_cast<cmGlobalVisualStudio7Generator*>(this->GlobalGenerator);
fout << "\t\t<Configuration\n"
<< "\t\t\tName=\"" << configName
- << "|" << gg->GetPlatformName() << "\"\n"
- << "\t\t\tOutputDirectory=\"" << configName << "\"\n";
+ << "|" << gg->GetPlatformName() << "\"\n";
// This is an internal type to Visual Studio, it seems that:
// 4 == static library
// 2 == dll
@@ -798,6 +797,16 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout,
std::string intermediateDir = this->GetTargetDirectory(target);
intermediateDir += "/";
intermediateDir += configName;
+
+ if (target.GetType() < cmTarget::UTILITY)
+ {
+ std::string const& outDir =
+ target.GetType() == cmTarget::OBJECT_LIBRARY?
+ intermediateDir : target.GetDirectory(configName);
+ fout << "\t\t\tOutputDirectory=\""
+ << this->ConvertToXMLOutputPathSingle(outDir.c_str()) << "\"\n";
+ }
+
fout << "\t\t\tIntermediateDirectory=\""
<< this->ConvertToXMLOutputPath(intermediateDir.c_str())
<< "\"\n"
@@ -1441,7 +1450,8 @@ cmLocalVisualStudio7Generator
// First search a configuration-specific subdirectory and then the
// original directory.
- fout << comma << this->ConvertToXMLOutputPath((dir+"/$(OutDir)").c_str())
+ fout << comma
+ << this->ConvertToXMLOutputPath((dir+"/$(ConfigurationName)").c_str())
<< "," << this->ConvertToXMLOutputPath(dir.c_str());
comma = ",";
}
diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx
index 69fcca7..29e8cb1 100644
--- a/Source/cmMacroCommand.cxx
+++ b/Source/cmMacroCommand.cxx
@@ -84,10 +84,6 @@ bool cmMacroHelperCommand::InvokeInitialPass
std::vector<std::string> expandedArgs;
this->Makefile->ExpandArguments(args, expandedArgs);
- std::string tmps;
- cmListFileArgument arg;
- std::string variable;
-
// make sure the number of arguments passed is at least the number
// required by the signature
if (expandedArgs.size() < this->Args.size() - 1)
@@ -111,11 +107,24 @@ bool cmMacroHelperCommand::InvokeInitialPass
argcDefStream << expandedArgs.size();
std::string argcDef = argcDefStream.str();
- // declare varuiables for ARGV ARGN but do not compute until needed
- std::string argvDef;
- std::string argnDef;
- bool argnDefInitialized = false;
- bool argvDefInitialized = false;
+ std::vector<std::string>::const_iterator eit
+ = expandedArgs.begin() + (this->Args.size() - 1);
+ std::string expandedArgn = cmJoin(cmRange(eit, expandedArgs.end()), ";");
+ std::string expandedArgv = cmJoin(expandedArgs, ";");
+ std::vector<std::string> variables;
+ variables.reserve(this->Args.size() - 1);
+ for (unsigned int j = 1; j < this->Args.size(); ++j)
+ {
+ variables.push_back("${" + this->Args[j] + "}");
+ }
+ std::vector<std::string> argVs;
+ argVs.reserve(expandedArgs.size());
+ char argvName[60];
+ for (unsigned int j = 0; j < expandedArgs.size(); ++j)
+ {
+ sprintf(argvName,"${ARGV%i}",j);
+ argVs.push_back(argvName);
+ }
if(!this->Functions.empty())
{
this->FilePath = this->Functions[0].FilePath;
@@ -140,81 +149,35 @@ bool cmMacroHelperCommand::InvokeInitialPass
// Set the FilePath on the arguments to match the function since it is
// not stored and the original values may be freed
k->FilePath = this->FilePath.c_str();
- if(k->Delim == cmListFileArgument::Bracket)
- {
- arg.Value = k->Value;
- }
- else
+
+ cmListFileArgument arg;
+ arg.Value = k->Value;
+ if(k->Delim != cmListFileArgument::Bracket)
{
- tmps = k->Value;
// replace formal arguments
- for (unsigned int j = 1; j < this->Args.size(); ++j)
+ for (unsigned int j = 0; j < variables.size(); ++j)
{
- variable = "${";
- variable += this->Args[j];
- variable += "}";
- cmSystemTools::ReplaceString(tmps, variable.c_str(),
- expandedArgs[j-1].c_str());
+ cmSystemTools::ReplaceString(arg.Value, variables[j].c_str(),
+ expandedArgs[j].c_str());
}
// replace argc
- cmSystemTools::ReplaceString(tmps, "${ARGC}",argcDef.c_str());
+ cmSystemTools::ReplaceString(arg.Value, "${ARGC}",argcDef.c_str());
- // repleace ARGN
- if (tmps.find("${ARGN}") != std::string::npos)
- {
- if (!argnDefInitialized)
- {
- std::vector<std::string>::const_iterator eit;
- std::vector<std::string>::size_type cnt = 0;
- for(eit = expandedArgs.begin(); eit != expandedArgs.end(); ++eit)
- {
- if ( cnt >= this->Args.size()-1 )
- {
- if (!argnDef.empty())
- {
- argnDef += ";";
- }
- argnDef += *eit;
- }
- cnt ++;
- }
- argnDefInitialized = true;
- }
- cmSystemTools::ReplaceString(tmps, "${ARGN}", argnDef.c_str());
- }
+ cmSystemTools::ReplaceString(arg.Value, "${ARGN}",
+ expandedArgn.c_str());
+ cmSystemTools::ReplaceString(arg.Value, "${ARGV}",
+ expandedArgv.c_str());
// if the current argument of the current function has ${ARGV in it
// then try replacing ARGV values
- if (tmps.find("${ARGV") != std::string::npos)
+ if (arg.Value.find("${ARGV") != std::string::npos)
{
- char argvName[60];
-
- // repleace ARGV, compute it only once
- if (!argvDefInitialized)
- {
- std::vector<std::string>::const_iterator eit;
- for(eit = expandedArgs.begin(); eit != expandedArgs.end(); ++eit)
- {
- if (!argvDef.empty())
- {
- argvDef += ";";
- }
- argvDef += *eit;
- }
- argvDefInitialized = true;
- }
- cmSystemTools::ReplaceString(tmps, "${ARGV}", argvDef.c_str());
-
- // also replace the ARGV1 ARGV2 ... etc
for (unsigned int t = 0; t < expandedArgs.size(); ++t)
{
- sprintf(argvName,"${ARGV%i}",t);
- cmSystemTools::ReplaceString(tmps, argvName,
+ cmSystemTools::ReplaceString(arg.Value, argVs[t].c_str(),
expandedArgs[t].c_str());
}
}
-
- arg.Value = tmps;
}
arg.Delim = k->Delim;
arg.FilePath = k->FilePath;
@@ -262,11 +225,11 @@ IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf,
if (!this->Depth)
{
std::string name = this->Args[0];
- std::vector<std::string>::size_type cc;
name += "(";
- for ( cc = 0; cc < this->Args.size(); cc ++ )
+ if (!this->Args.empty())
{
- name += " " + this->Args[cc];
+ name += " ";
+ name += cmJoin(this->Args, " ");
}
name += " )";
mf.AddMacro(this->Args[0].c_str(), name.c_str());
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index ba914e1..ac5fec9 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -38,6 +38,7 @@
#include <cmsys/auto_ptr.hxx>
#include <stack>
+#include <list>
#include <ctype.h> // for isspace
#include <assert.h>
@@ -3576,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,
@@ -3764,15 +3752,12 @@ void cmMakefile::GetListOfMacros(std::string& macros) const
{
StringStringMap::const_iterator it;
macros = "";
- int cc = 0;
+ const char* sep = "";
for ( it = this->MacrosMap.begin(); it != this->MacrosMap.end(); ++it )
{
- if ( cc > 0 )
- {
- macros += ";";
- }
+ macros += sep;
macros += it->first;
- cc ++;
+ sep = "";
}
}
@@ -4217,16 +4202,7 @@ const char *cmMakefile::GetProperty(const std::string& prop,
}
else if (prop == "LISTFILE_STACK")
{
- for (std::deque<std::string>::const_iterator
- i = this->ListFileStack.begin();
- i != this->ListFileStack.end(); ++i)
- {
- if (i != this->ListFileStack.begin())
- {
- output += ";";
- }
- output += *i;
- }
+ output = cmJoin(this->ListFileStack, ";");
return output.c_str();
}
else if (prop == "VARIABLES" || prop == "CACHE_VARIABLES")
@@ -4236,15 +4212,7 @@ const char *cmMakefile::GetProperty(const std::string& prop,
{
cacheonly = 1;
}
- std::vector<std::string> vars = this->GetDefinitions(cacheonly);
- for (unsigned int cc = 0; cc < vars.size(); cc ++ )
- {
- if ( cc > 0 )
- {
- output += ";";
- }
- output += vars[cc];
- }
+ output = cmJoin(this->GetDefinitions(cacheonly), ";");
return output.c_str();
}
else if (prop == "MACROS")
@@ -4259,19 +4227,7 @@ const char *cmMakefile::GetProperty(const std::string& prop,
}
else if (prop == "LINK_DIRECTORIES")
{
- std::ostringstream str;
- for (std::vector<std::string>::const_iterator
- it = this->GetLinkDirectories().begin();
- it != this->GetLinkDirectories().end();
- ++ it )
- {
- if ( it != this->GetLinkDirectories().begin())
- {
- str << ";";
- }
- str << it->c_str();
- }
- output = str.str();
+ output = cmJoin(this->GetLinkDirectories(), ";");
return output.c_str();
}
else if (prop == "INCLUDE_DIRECTORIES")
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index bff8c12..895a2fc 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -35,6 +35,7 @@
#endif
#include <stack>
+#include <deque>
class cmFunctionBlocker;
class cmCommand;
@@ -599,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/cmMessageCommand.cxx b/Source/cmMessageCommand.cxx
index 88d6a77..0449c50 100644
--- a/Source/cmMessageCommand.cxx
+++ b/Source/cmMessageCommand.cxx
@@ -20,7 +20,6 @@ bool cmMessageCommand
this->SetError("called with incorrect number of arguments");
return false;
}
- std::string message;
std::vector<std::string>::const_iterator i = args.begin();
cmake::MessageType type = cmake::MESSAGE;
@@ -70,10 +69,7 @@ bool cmMessageCommand
++i;
}
- for(;i != args.end(); ++i)
- {
- message += *i;
- }
+ std::string message = cmJoin(cmRange(i, args.end()), std::string());
if (type != cmake::MESSAGE)
{
diff --git a/Source/cmOptionCommand.cxx b/Source/cmOptionCommand.cxx
index e505440..60728ea 100644
--- a/Source/cmOptionCommand.cxx
+++ b/Source/cmOptionCommand.cxx
@@ -34,11 +34,7 @@ bool cmOptionCommand
if(argError)
{
std::string m = "called with incorrect number of arguments: ";
- for(size_t i =0; i < args.size(); ++i)
- {
- m += args[i];
- m += " ";
- }
+ m += cmJoin(args, " ");
this->SetError(m);
return false;
}
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/cmQtAutoGenerators.h b/Source/cmQtAutoGenerators.h
index 79fa5df..f74e3c5 100644
--- a/Source/cmQtAutoGenerators.h
+++ b/Source/cmQtAutoGenerators.h
@@ -14,6 +14,8 @@
#ifndef cmQtAutoGenerators_h
#define cmQtAutoGenerators_h
+#include <list>
+
class cmGlobalGenerator;
class cmMakefile;
diff --git a/Source/cmRST.cxx b/Source/cmRST.cxx
index f4607c6..d20d999 100644
--- a/Source/cmRST.cxx
+++ b/Source/cmRST.cxx
@@ -12,6 +12,7 @@
#include "cmRST.h"
#include "cmSystemTools.h"
+#include "cmAlgorithms.h"
#include "cmVersion.h"
#include <cmsys/FStream.hxx>
#include <ctype.h>
diff --git a/Source/cmSetCommand.cxx b/Source/cmSetCommand.cxx
index 90d7b03..204d95b 100644
--- a/Source/cmSetCommand.cxx
+++ b/Source/cmSetCommand.cxx
@@ -108,17 +108,7 @@ bool cmSetCommand
}
// collect any values into a single semi-colon separated value list
- if(static_cast<unsigned short>(args.size()) >
- static_cast<unsigned short>(1 + ignoreLastArgs))
- {
- value = args[1];
- size_t endPos = args.size() - ignoreLastArgs;
- for(size_t i = 2; i < endPos; ++i)
- {
- value += ";";
- value += args[i];
- }
- }
+ value = cmJoin(cmRange(args).advance(1).retreat(ignoreLastArgs), ";");
if (parentScope)
{
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/cmStandardIncludes.h b/Source/cmStandardIncludes.h
index 646300d..a9796b9 100644
--- a/Source/cmStandardIncludes.h
+++ b/Source/cmStandardIncludes.h
@@ -22,7 +22,6 @@
#ifdef _MSC_VER
#pragma warning ( disable : 4786 )
#pragma warning ( disable : 4503 )
-#pragma warning ( disable : 4512 ) /* operator=() could not be generated */
#endif
@@ -42,11 +41,6 @@
# include <cmsys/IOStream.hxx>
#endif
-// Avoid warnings in system headers.
-#if defined(_MSC_VER)
-# pragma warning (push,1)
-#endif
-
#include <fstream>
#include <iostream>
#include <iomanip>
@@ -59,13 +53,7 @@
#include <algorithm>
#include <functional>
#include <map>
-#include <list>
#include <set>
-#include <deque>
-
-#if defined(_MSC_VER)
-# pragma warning(pop)
-#endif
// include the "c" string header
#include <string.h>
@@ -143,138 +131,4 @@ static thisClass* SafeDownCast(cmObject *c) \
} \
class cmTypeMacro_UseTrailingSemicolon
-template<typename Range>
-std::string cmJoin(Range const& r, const char* delimiter)
-{
- if (r.empty())
- {
- return std::string();
- }
- std::ostringstream os;
- typedef typename Range::value_type ValueType;
- typedef typename Range::const_iterator InputIt;
- InputIt first = r.begin();
- InputIt last = r.end();
- --last;
- std::copy(first, last,
- std::ostream_iterator<ValueType>(os, delimiter));
-
- os << *last;
-
- return os.str();
-}
-
-template<typename Range>
-std::string cmJoin(Range const& r, std::string delimiter)
-{
- return cmJoin(r, delimiter.c_str());
-};
-
-inline bool cmHasLiteralPrefixImpl(const std::string &str1,
- const char *str2,
- size_t N)
-{
- return strncmp(str1.c_str(), str2, N) == 0;
-}
-
-inline bool cmHasLiteralPrefixImpl(const char* str1,
- const char *str2,
- size_t N)
-{
- return strncmp(str1, str2, N) == 0;
-}
-
-inline bool cmHasLiteralSuffixImpl(const std::string &str1,
- const char *str2,
- size_t N)
-{
- size_t len = str1.size();
- return len >= N && strcmp(str1.c_str() + len - N, str2) == 0;
-}
-
-inline bool cmHasLiteralSuffixImpl(const char* str1,
- const char* str2,
- size_t N)
-{
- size_t len = strlen(str1);
- return len >= N && strcmp(str1 + len - N, str2) == 0;
-}
-
-template<typename T, size_t N>
-const T* cmArrayBegin(const T (&a)[N]) { return a; }
-template<typename T, size_t N>
-const T* cmArrayEnd(const T (&a)[N]) { return a + N; }
-template<typename T, size_t N>
-size_t cmArraySize(const T (&)[N]) { return N; }
-
-template<typename T, size_t N>
-bool cmHasLiteralPrefix(T str1, const char (&str2)[N])
-{
- return cmHasLiteralPrefixImpl(str1, str2, N - 1);
-}
-
-template<typename T, size_t N>
-bool cmHasLiteralSuffix(T str1, const char (&str2)[N])
-{
- return cmHasLiteralSuffixImpl(str1, str2, N - 1);
-}
-
-struct cmStrCmp {
- cmStrCmp(const char *test) : m_test(test) {}
- cmStrCmp(const std::string &test) : m_test(test) {}
-
- bool operator()(const std::string& input) const
- {
- return m_test == input;
- }
-
- bool operator()(const char * input) const
- {
- return strcmp(input, m_test.c_str()) == 0;
- }
-
-private:
- const std::string m_test;
-};
-
-namespace ContainerAlgorithms {
-
-template<typename T>
-struct cmIsPair
-{
- enum { value = false };
-};
-
-template<typename K, typename V>
-struct cmIsPair<std::pair<K, V> >
-{
- enum { value = true };
-};
-
-template<typename Container,
- bool valueTypeIsPair = cmIsPair<typename Container::value_type>::value>
-struct DefaultDeleter
-{
- void operator()(typename Container::value_type value) {
- delete value;
- }
-};
-
-template<typename Container>
-struct DefaultDeleter<Container, /* valueTypeIsPair = */ true>
-{
- void operator()(typename Container::value_type value) {
- delete value.second;
- }
-};
-
-}
-
-template<typename Container>
-void cmDeleteAll(Container const& c)
-{
- std::for_each(c.begin(), c.end(),
- ContainerAlgorithms::DefaultDeleter<Container>());
-}
-
#endif
diff --git a/Source/cmStringCommand.cxx b/Source/cmStringCommand.cxx
index 3e606d7..edc6afc 100644
--- a/Source/cmStringCommand.cxx
+++ b/Source/cmStringCommand.cxx
@@ -303,13 +303,6 @@ bool cmStringCommand::RegexMatch(std::vector<std::string> const& args)
std::string regex = args[2];
std::string outvar = args[3];
- // Concatenate all the last arguments together.
- std::string input = args[4];
- for(unsigned int i=5; i < args.size(); ++i)
- {
- input += args[i];
- }
-
this->Makefile->ClearMatches();
// Compile the regular expression.
cmsys::RegularExpression re;
@@ -321,6 +314,9 @@ bool cmStringCommand::RegexMatch(std::vector<std::string> const& args)
return false;
}
+ // Concatenate all the last arguments together.
+ std::string input = cmJoin(cmRange(args).advance(4), std::string());
+
// Scan through the input for all matches.
std::string output;
if(re.find(input.c_str()))
@@ -352,13 +348,6 @@ bool cmStringCommand::RegexMatchAll(std::vector<std::string> const& args)
std::string regex = args[2];
std::string outvar = args[3];
- // Concatenate all the last arguments together.
- std::string input = args[4];
- for(unsigned int i=5; i < args.size(); ++i)
- {
- input += args[i];
- }
-
this->Makefile->ClearMatches();
// Compile the regular expression.
cmsys::RegularExpression re;
@@ -371,6 +360,9 @@ bool cmStringCommand::RegexMatchAll(std::vector<std::string> const& args)
return false;
}
+ // Concatenate all the last arguments together.
+ std::string input = cmJoin(cmRange(args).advance(4), std::string());
+
// Scan through the input for all matches.
std::string output;
const char* p = input.c_str();
@@ -456,13 +448,6 @@ bool cmStringCommand::RegexReplace(std::vector<std::string> const& args)
l = r;
}
- // Concatenate all the last arguments together.
- std::string input = args[5];
- for(unsigned int i=6; i < args.size(); ++i)
- {
- input += args[i];
- }
-
this->Makefile->ClearMatches();
// Compile the regular expression.
cmsys::RegularExpression re;
@@ -475,6 +460,9 @@ bool cmStringCommand::RegexReplace(std::vector<std::string> const& args)
return false;
}
+ // Concatenate all the last arguments together.
+ std::string input = cmJoin(cmRange(args).advance(5), std::string());
+
// Scan through the input for all matches.
std::string output;
std::string::size_type base = 0;
@@ -673,11 +661,7 @@ bool cmStringCommand::HandleReplaceCommand(std::vector<std::string> const&
const std::string& replaceExpression = args[2];
const std::string& variableName = args[3];
- std::string input = args[4];
- for(unsigned int i=5; i < args.size(); ++i)
- {
- input += args[i];
- }
+ std::string input = cmJoin(cmRange(args).advance(4), std::string());
cmsys::SystemTools::ReplaceString(input, matchExpression.c_str(),
replaceExpression.c_str());
@@ -756,11 +740,7 @@ bool cmStringCommand
}
std::string const& variableName = args[1];
- std::string value;
- for(unsigned int i = 2; i < args.size(); ++i)
- {
- value += args[i];
- }
+ std::string value = cmJoin(cmRange(args).advance(2), std::string());
this->Makefile->AddDefinition(variableName, value.c_str());
return true;
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index 6a7467f..bf496e9 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -11,6 +11,7 @@
============================================================================*/
#include "cmSystemTools.h"
+#include "cmAlgorithms.h"
#include <ctype.h>
#include <errno.h>
#include <time.h>
@@ -28,10 +29,10 @@
# 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>
@@ -367,13 +368,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)
@@ -2287,7 +2292,6 @@ std::string const& cmSystemTools::GetCMakeRoot()
}
//----------------------------------------------------------------------------
-#if defined(CMAKE_BUILD_WITH_CMAKE)
void cmSystemTools::MakefileColorEcho(int color, const char* message,
bool newline, bool enabled)
{
@@ -2308,16 +2312,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,
@@ -2698,7 +2707,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..1ad0d48 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;
}
@@ -4715,13 +4711,11 @@ bool cmTarget::IsNullImpliedByLinkLibraries(const std::string &p) const
//----------------------------------------------------------------------------
template<typename PropertyType>
-PropertyType getTypedProperty(cmTarget const* tgt, const std::string& prop,
- PropertyType *);
+PropertyType getTypedProperty(cmTarget const* tgt, const std::string& prop);
//----------------------------------------------------------------------------
template<>
-bool getTypedProperty<bool>(cmTarget const* tgt, const std::string& prop,
- bool *)
+bool getTypedProperty<bool>(cmTarget const* tgt, const std::string& prop)
{
return tgt->GetPropertyAsBool(prop);
}
@@ -4729,8 +4723,7 @@ bool getTypedProperty<bool>(cmTarget const* tgt, const std::string& prop,
//----------------------------------------------------------------------------
template<>
const char *getTypedProperty<const char *>(cmTarget const* tgt,
- const std::string& prop,
- const char **)
+ const std::string& prop)
{
return tgt->GetProperty(prop);
}
@@ -4941,8 +4934,7 @@ PropertyType checkInterfacePropertyCompatibility(cmTarget const* tgt,
CompatibleType t,
PropertyType *)
{
- PropertyType propContent = getTypedProperty<PropertyType>(tgt, p,
- 0);
+ PropertyType propContent = getTypedProperty<PropertyType>(tgt, p);
const bool explicitlySet = tgt->GetProperties()
.find(p)
!= tgt->GetProperties().end();
@@ -4995,7 +4987,7 @@ PropertyType checkInterfacePropertyCompatibility(cmTarget const* tgt,
!= theTarget->GetProperties().end();
PropertyType ifacePropContent =
getTypedProperty<PropertyType>(theTarget,
- interfaceProperty, 0);
+ interfaceProperty);
std::string reportEntry;
if (ifaceIsSet)
@@ -5919,8 +5911,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)
@@ -6692,40 +6683,33 @@ void cmTarget::CheckPropertyCompatibility(cmComputeLinkInformation *info,
if (!prop.empty())
{
- // Use a std::set to keep the error message sorted.
- std::set<std::string> props;
+ // Use a sorted std::vector to keep the error message sorted.
+ std::vector<std::string> props;
std::set<std::string>::const_iterator i = emittedBools.find(prop);
if (i != emittedBools.end())
{
- props.insert(strBool);
+ props.push_back(strBool);
}
i = emittedStrings.find(prop);
if (i != emittedStrings.end())
{
- props.insert(strString);
+ props.push_back(strString);
}
i = emittedMinNumbers.find(prop);
if (i != emittedMinNumbers.end())
{
- props.insert(strNumMin);
+ props.push_back(strNumMin);
}
i = emittedMaxNumbers.find(prop);
if (i != emittedMaxNumbers.end())
{
- props.insert(strNumMax);
+ props.push_back(strNumMax);
}
+ std::sort(props.begin(), props.end());
+
+ std::string propsString = cmJoin(cmRange(props).retreat(1), ", ");
+ propsString += " and the " + props.back();
- std::string propsString = *props.begin();
- props.erase(props.begin());
- while (props.size() > 1)
- {
- propsString += ", " + *props.begin();
- props.erase(props.begin());
- }
- if (props.size() == 1)
- {
- propsString += " and the " + *props.begin();
- }
std::ostringstream e;
e << "Property \"" << prop << "\" appears in both the "
<< propsString <<
diff --git a/Source/cmVariableWatch.cxx b/Source/cmVariableWatch.cxx
index b8a6df2..57dde31 100644
--- a/Source/cmVariableWatch.cxx
+++ b/Source/cmVariableWatch.cxx
@@ -11,6 +11,8 @@
============================================================================*/
#include "cmVariableWatch.h"
+#include "cmAlgorithms.h"
+
static const char* const cmVariableWatchAccessStrings[] =
{
"READ_ACCESS",
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 652e451..47be481 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -103,6 +103,8 @@
#include <sys/stat.h> // struct stat
+#include <list>
+
static bool cmakeCheckStampFile(const char* stampName);
static bool cmakeCheckStampList(const char* stampName);
@@ -2731,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/cmcmd.cxx b/Source/cmcmd.cxx
index 28fcd27..6a7dc6e 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"
@@ -287,8 +287,6 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
}
#if defined(CMAKE_BUILD_WITH_CMAKE)
- // Command to create a symbolic link. Fails on platforms not
- // supporting them.
else if (args[1] == "environment" )
{
std::vector<std::string> env = cmSystemTools::GetEnvironmentVariables();
@@ -352,8 +350,6 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
{
for (std::string::size_type cc = 2; cc < args.size(); cc ++)
{
- // Complain if the file could not be removed, still exists,
- // and the -f option was not given.
if(!cmSystemTools::Touch(args[cc], true))
{
return 1;
@@ -406,12 +402,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
// Clock command
else if (args[1] == "time" && args.size() > 2)
{
- std::string command = args[2];
- for (std::string::size_type cc = 3; cc < args.size(); cc ++)
- {
- command += " ";
- command += args[cc];
- }
+ std::string command = cmJoin(cmRange(args).advance(2), " ");
clock_t clock_start, clock_finish;
time_t time_start, time_finish;
@@ -473,14 +464,8 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
}
std::string command = "\"";
- command += args[3];
+ command += cmJoin(cmRange(args).advance(3), "\" \"");
command += "\"";
- for (std::string::size_type cc = 4; cc < args.size(); cc ++)
- {
- command += " \"";
- command += args[cc];
- command += "\"";
- }
int retval = 0;
int timeout = 0;
if ( cmSystemTools::RunSingleCommand(command.c_str(), 0, &retval,
@@ -534,48 +519,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 +699,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 +933,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 +1001,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 +1020,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 +1090,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)