From 4419909756751170d6fd4248b205c96767220dee Mon Sep 17 00:00:00 2001
From: Brad King <brad.king@kitware.com>
Date: Tue, 24 May 2016 11:38:18 -0400
Subject: [PATCH] cmMakefile: Optimize AddSystemIncludeDirectories for empty
 set

Do not bother looping over all targets if we have no system include
directories to add anyway.
---
 Source/cmMakefile.cxx | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 7e99f2c2de..e684689f0f 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -1574,6 +1574,10 @@ void cmMakefile::AddIncludeDirectories(const std::vector<std::string>& incs,
 
 void cmMakefile::AddSystemIncludeDirectories(const std::set<std::string>& incs)
 {
+  if (incs.empty()) {
+    return;
+  }
+
   this->SystemIncludeDirectories.insert(incs.begin(), incs.end());
 
   for (cmTargets::iterator l = this->Targets.begin(); l != this->Targets.end();
-- 
GitLab