[Cmake-commits] CMake branch, next, updated. v3.8.0-rc1-83-gfe4c8e4
Daniel Pfeifer
daniel at pfeifer-mail.de
Fri Feb 10 17:05:33 EST 2017
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".
The branch, next has been updated
via fe4c8e497ce4eb67bd14187f8729710a72cfe37a (commit)
via c3800e54583208ac4a6435884bb8832e72af3183 (commit)
from 97eb120fd3b755ceb24da8ab159ecd68a8f62330 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=fe4c8e497ce4eb67bd14187f8729710a72cfe37a
commit fe4c8e497ce4eb67bd14187f8729710a72cfe37a
Merge: 97eb120 c3800e5
Author: Daniel Pfeifer <daniel at pfeifer-mail.de>
AuthorDate: Fri Feb 10 17:05:32 2017 -0500
Commit: CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Fri Feb 10 17:05:32 2017 -0500
Merge topic 'erase-if' into next
c3800e54 cmAlgorithms: add cmEraseIf function
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c3800e54583208ac4a6435884bb8832e72af3183
commit c3800e54583208ac4a6435884bb8832e72af3183
Author: Daniel Pfeifer <daniel at pfeifer-mail.de>
AuthorDate: Fri Feb 10 23:04:32 2017 +0100
Commit: Daniel Pfeifer <daniel at pfeifer-mail.de>
CommitDate: Fri Feb 10 23:04:32 2017 +0100
cmAlgorithms: add cmEraseIf function
diff --git a/Source/cmAlgorithms.h b/Source/cmAlgorithms.h
index 7c683ad..f5469e5 100644
--- a/Source/cmAlgorithms.h
+++ b/Source/cmAlgorithms.h
@@ -101,6 +101,12 @@ FwdIt cmRotate(FwdIt first, FwdIt middle, FwdIt last)
return first;
}
+template <typename Container, typename Predicate>
+void cmEraseIf(Container& cont, Predicate pred)
+{
+ cont.erase(std::remove_if(cont.begin(), cont.end(), pred), cont.end());
+}
+
namespace ContainerAlgorithms {
template <typename T>
diff --git a/Source/cmGlobalVisualStudio14Generator.cxx b/Source/cmGlobalVisualStudio14Generator.cxx
index 81c305c..d2ac36b 100644
--- a/Source/cmGlobalVisualStudio14Generator.cxx
+++ b/Source/cmGlobalVisualStudio14Generator.cxx
@@ -238,8 +238,7 @@ std::string cmGlobalVisualStudio14Generator::GetWindows10SDKVersion()
// Skip SDKs that do not contain <um/windows.h> because that indicates that
// only the UCRT MSIs were installed for them.
- sdks.erase(std::remove_if(sdks.begin(), sdks.end(), NoWindowsH()),
- sdks.end());
+ cmEraseIf(sdks, NoWindowsH());
if (!sdks.empty()) {
// Only use the filename, which will be the SDK version.
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index 41a4caf..4388e75 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -1864,10 +1864,7 @@ void cmLocalUnixMakefileGenerator3::WriteDependLanguageInfo(
std::string binaryDir = this->GetState()->GetBinaryDirectory();
if (this->Makefile->IsOn("CMAKE_DEPENDS_IN_PROJECT_ONLY")) {
const char* sourceDir = this->GetState()->GetSourceDirectory();
- std::vector<std::string>::iterator itr =
- std::remove_if(includes.begin(), includes.end(),
- ::NotInProjectDir(sourceDir, binaryDir));
- includes.erase(itr, includes.end());
+ cmEraseIf(includes, ::NotInProjectDir(sourceDir, binaryDir));
}
for (std::vector<std::string>::iterator i = includes.begin();
i != includes.end(); ++i) {
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index bfe46ae..618f694 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -653,21 +653,12 @@ void cmMakefile::FinalPass()
// we don't want cmake to re-run if a configured file is created and deleted
// during processing as that would make it a transient file that can't
// influence the build process
-
- // remove_if will move all items that don't have a valid file name to the
- // back of the vector
- std::vector<std::string>::iterator new_output_files_end = std::remove_if(
- this->OutputFiles.begin(), this->OutputFiles.end(), file_not_persistent());
- // we just have to erase all items at the back
- this->OutputFiles.erase(new_output_files_end, this->OutputFiles.end());
+ cmEraseIf(this->OutputFiles, file_not_persistent());
// if a configured file is used as input for another configured file,
// and then deleted it will show up in the input list files so we
// need to scan those too
- std::vector<std::string>::iterator new_list_files_end = std::remove_if(
- this->ListFiles.begin(), this->ListFiles.end(), file_not_persistent());
-
- this->ListFiles.erase(new_list_files_end, this->ListFiles.end());
+ cmEraseIf(this->ListFiles, file_not_persistent());
}
// Generate the output file
diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx
index b172478..9bf0ccd 100644
--- a/Source/cmNinjaNormalTargetGenerator.cxx
+++ b/Source/cmNinjaNormalTargetGenerator.cxx
@@ -260,12 +260,9 @@ void cmNinjaNormalTargetGenerator::WriteDeviceLinkRule(bool useResponseFile)
rulePlaceholderExpander->ExpandRuleVariables(this->GetLocalGenerator(),
*i, vars);
}
- {
- // If there is no ranlib the command will be ":". Skip it.
- std::vector<std::string>::iterator newEnd = std::remove_if(
- linkCmds.begin(), linkCmds.end(), cmNinjaRemoveNoOpCommands());
- linkCmds.erase(newEnd, linkCmds.end());
- }
+
+ // If there is no ranlib the command will be ":". Skip it.
+ cmEraseIf(linkCmds, cmNinjaRemoveNoOpCommands());
std::string linkCmd =
this->GetLocalGenerator()->BuildCommandLine(linkCmds);
@@ -388,12 +385,9 @@ void cmNinjaNormalTargetGenerator::WriteLinkRule(bool useResponseFile)
rulePlaceholderExpander->ExpandRuleVariables(this->GetLocalGenerator(),
*i, vars);
}
- {
- // If there is no ranlib the command will be ":". Skip it.
- std::vector<std::string>::iterator newEnd = std::remove_if(
- linkCmds.begin(), linkCmds.end(), cmNinjaRemoveNoOpCommands());
- linkCmds.erase(newEnd, linkCmds.end());
- }
+
+ // If there is no ranlib the command will be ":". Skip it.
+ cmEraseIf(linkCmds, cmNinjaRemoveNoOpCommands());
linkCmds.insert(linkCmds.begin(), "$PRE_LINK");
linkCmds.push_back("$POST_BUILD");
-----------------------------------------------------------------------
Summary of changes:
Source/cmAlgorithms.h | 6 ++++++
Source/cmGlobalVisualStudio14Generator.cxx | 3 +--
Source/cmLocalUnixMakefileGenerator3.cxx | 5 +----
Source/cmMakefile.cxx | 13 ++-----------
Source/cmNinjaNormalTargetGenerator.cxx | 18 ++++++------------
5 files changed, 16 insertions(+), 29 deletions(-)
hooks/post-receive
--
CMake
More information about the Cmake-commits
mailing list