[Cmake-commits] CMake branch, next, updated. v2.8.10.2-1669-ga3d8a24

Stephen Kelly steveire at gmail.com
Sun Jan 20 06:36:27 EST 2013


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  a3d8a241d07a0c2de01e76bbea77429389cfc900 (commit)
       via  bfa8a14616a50012fd6967001481ccbac56c9f13 (commit)
      from  c9a242d1b0fe87084f7f604199ad47e2564d285e (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 -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a3d8a241d07a0c2de01e76bbea77429389cfc900
commit a3d8a241d07a0c2de01e76bbea77429389cfc900
Merge: c9a242d bfa8a14
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Sun Jan 20 06:36:24 2013 -0500
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Sun Jan 20 06:36:24 2013 -0500

    Merge topic 'group-include-directories' into next
    
    bfa8a14 Store includes from the same include_directories call together.


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=bfa8a14616a50012fd6967001481ccbac56c9f13
commit bfa8a14616a50012fd6967001481ccbac56c9f13
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Sun Jan 20 12:28:59 2013 +0100
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Sun Jan 20 12:34:45 2013 +0100

    Store includes from the same include_directories call together.
    
    Otherwise, we get a separate IncludeDirectoriesEntry for each include,
    and that causes unnecessary and confusing splitting in the output when
    debugging the INCLUDE_DIRECTORIES property.

diff --git a/Source/cmFLTKWrapUICommand.cxx b/Source/cmFLTKWrapUICommand.cxx
index a4aa75a..b08c335 100644
--- a/Source/cmFLTKWrapUICommand.cxx
+++ b/Source/cmFLTKWrapUICommand.cxx
@@ -37,9 +37,13 @@ bool cmFLTKWrapUICommand
   // get the list of GUI files from which .cxx and .h will be generated
   std::string outputDirectory = this->Makefile->GetCurrentOutputDirectory();
 
+  {
   // Some of the generated files are *.h so the directory "GUI"
   // where they are created have to be added to the include path
-  this->Makefile->AddIncludeDirectory( outputDirectory.c_str() );
+  std::vector<std::string> outputDirectories;
+  outputDirectories.push_back(outputDirectory);
+  this->Makefile->AddIncludeDirectories( outputDirectories );
+  }
 
   for(std::vector<std::string>::iterator i = (newArgs.begin() + 1);
       i != newArgs.end(); i++)
diff --git a/Source/cmIncludeDirectoryCommand.cxx b/Source/cmIncludeDirectoryCommand.cxx
index ba81849..bfee06f 100644
--- a/Source/cmIncludeDirectoryCommand.cxx
+++ b/Source/cmIncludeDirectoryCommand.cxx
@@ -36,6 +36,10 @@ bool cmIncludeDirectoryCommand
     ++i;
     }
 
+  std::vector<std::string> beforeIncludes;
+  std::vector<std::string> afterIncludes;
+  std::set<cmStdString> systemIncludes;
+
   for(; i != args.end(); ++i)
     {
     if(*i == "SYSTEM")
@@ -49,9 +53,33 @@ bool cmIncludeDirectoryCommand
       return false;
       }
 
-    this->AddDirectory(i->c_str(),before,system);
+    std::vector<std::string> includes;
+
+    GetIncludes(*i, includes);
 
+    if (before)
+      {
+      beforeIncludes.insert(beforeIncludes.end(),
+                            includes.begin(),
+                            includes.end());
+      }
+    else
+      {
+      afterIncludes.insert(afterIncludes.end(),
+                           includes.begin(),
+                           includes.end());
+      }
+    if (system)
+      {
+      systemIncludes.insert(includes.begin(), includes.end());
+      }
     }
+  std::reverse(beforeIncludes.begin(), beforeIncludes.end());
+
+  this->Makefile->AddIncludeDirectories(afterIncludes);
+  this->Makefile->AddIncludeDirectories(beforeIncludes, before);
+  this->Makefile->AddSystemIncludeDirectories(systemIncludes);
+
   return true;
 }
 
@@ -72,57 +100,49 @@ static bool StartsWithGeneratorExpression(const std::string &input)
 // output from a program and passing it into a command the cleanup doesn't
 // always happen
 //
-void cmIncludeDirectoryCommand::AddDirectory(const char *i,
-                                             bool before,
-                                             bool system)
+void cmIncludeDirectoryCommand::GetIncludes(const std::string &arg,
+                                            std::vector<std::string> &incs)
 {
   // break apart any line feed arguments
-  std::string ret = i;
   std::string::size_type pos = 0;
-  if((pos = ret.find('\n', pos)) != std::string::npos)
+  std::string::size_type lastPos = 0;
+  while((pos = arg.find('\n', lastPos)) != std::string::npos)
     {
     if (pos)
       {
-      this->AddDirectory(ret.substr(0,pos).c_str(), before, system);
+      std::string inc = arg.substr(lastPos,pos);
+      NormalizeInclude(inc);
+      incs.push_back(inc);
       }
-    if (ret.size()-pos-1)
-      {
-      this->AddDirectory(ret.substr(pos+1,ret.size()-pos-1).c_str(),
-                         before, system);
-      }
-    return;
+    lastPos = pos + 1;
     }
+  std::string inc = arg.substr(lastPos);
+  NormalizeInclude(inc);
+  incs.push_back(inc);
+}
 
-  // remove any leading or trailing spaces and \r
-  std::string::size_type b = ret.find_first_not_of(" \r");
-  std::string::size_type e = ret.find_last_not_of(" \r");
-  if ((b!=ret.npos) && (e!=ret.npos))
-    {
-    ret.assign(ret, b, 1+e-b);   // copy the remaining substring
-    }
-  else
+void cmIncludeDirectoryCommand::NormalizeInclude(std::string &inc)
+{
+  std::string::size_type b = inc.find_first_not_of(" \r");
+  std::string::size_type e = inc.find_last_not_of(" \r");
+  if ((b!=inc.npos) && (e!=inc.npos))
     {
-    return;         // if we get here, we had only whitespace in the string
+    inc.assign(inc, b, 1+e-b);   // copy the remaining substring
     }
 
-  if (!cmSystemTools::IsOff(ret.c_str()))
+  if (!cmSystemTools::IsOff(inc.c_str()))
     {
-    cmSystemTools::ConvertToUnixSlashes(ret);
-    if(!cmSystemTools::FileIsFullPath(ret.c_str()))
+    cmSystemTools::ConvertToUnixSlashes(inc);
+
+    if(!cmSystemTools::FileIsFullPath(inc.c_str()))
       {
-      if(!StartsWithGeneratorExpression(ret))
+      if(!StartsWithGeneratorExpression(inc))
         {
         std::string tmp = this->Makefile->GetStartDirectory();
         tmp += "/";
-        tmp += ret;
-        ret = tmp;
+        tmp += inc;
+        inc = tmp;
         }
       }
     }
-  this->Makefile->AddIncludeDirectory(ret.c_str(), before);
-  if(system)
-    {
-    this->Makefile->AddSystemIncludeDirectory(ret.c_str());
-    }
 }
-
diff --git a/Source/cmIncludeDirectoryCommand.h b/Source/cmIncludeDirectoryCommand.h
index dd37b82..a32fc77 100644
--- a/Source/cmIncludeDirectoryCommand.h
+++ b/Source/cmIncludeDirectoryCommand.h
@@ -84,7 +84,8 @@ public:
 
 protected:
   // used internally
-  void AddDirectory(const char *arg, bool before, bool system);
+  void GetIncludes(const std::string &arg, std::vector<std::string> &incs);
+  void NormalizeInclude(std::string &inc);
 };
 
 
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index b432986..602cf07 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -1616,20 +1616,31 @@ void cmMakefile::AddSubDirectory(const char* srcPath, const char *binPath,
 }
 
 //----------------------------------------------------------------------------
-void cmMakefile::AddIncludeDirectory(const char* inc, bool before)
+void cmMakefile::AddIncludeDirectories(const std::vector<std::string> &incs,
+                                       bool before)
 {
-  if (!inc)
+  if (incs.empty())
     {
     return;
     }
 
+  std::string incString;
+  std::string sep;
+
+  for(std::vector<std::string>::const_iterator li = incs.begin();
+      li != incs.end(); ++li)
+    {
+    incString += sep + *li;
+    sep = ";";
+    }
+
   std::vector<IncludeDirectoriesEntry>::iterator position =
-                               before ? this->IncludeDirectoriesEntries.begin()
-                                      : this->IncludeDirectoriesEntries.end();
+                              before ? this->IncludeDirectoriesEntries.begin()
+                                    : this->IncludeDirectoriesEntries.end();
 
   cmListFileBacktrace lfbt;
   this->GetBacktrace(lfbt);
-  IncludeDirectoriesEntry entry(inc, lfbt);
+  IncludeDirectoriesEntry entry(incString, lfbt);
   this->IncludeDirectoriesEntries.insert(position, entry);
 
   // Property on each target:
@@ -1642,9 +1653,10 @@ void cmMakefile::AddIncludeDirectory(const char* inc, bool before)
 }
 
 //----------------------------------------------------------------------------
-void cmMakefile::AddSystemIncludeDirectory(const char* dir)
+void
+cmMakefile::AddSystemIncludeDirectories(const std::set<cmStdString> &incs)
 {
-  this->SystemIncludeDirectories.insert(dir);
+  this->SystemIncludeDirectories.insert(incs.begin(), incs.end());
 }
 
 //----------------------------------------------------------------------------
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index a85015f..bb161b1 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -287,7 +287,8 @@ public:
   /**
    * Add an include directory to the build.
    */
-  void AddIncludeDirectory(const char*, bool before = false);
+  void AddIncludeDirectories(const std::vector<std::string> &incs,
+                             bool before = false);
 
   /**
    * Add a variable definition to the build. This variable
@@ -545,7 +546,7 @@ public:
   /**
    * Mark include directories as system directories.
    */
-  void AddSystemIncludeDirectory(const char* dir);
+  void AddSystemIncludeDirectories(const std::set<cmStdString> &incs);
   bool IsSystemIncludeDirectory(const char* dir);
 
   /** Expand out any arguements in the vector that have ; separated
diff --git a/Tests/RunCMake/include_directories/DebugIncludes-stderr.txt b/Tests/RunCMake/include_directories/DebugIncludes-stderr.txt
index 948def1..ab99784 100644
--- a/Tests/RunCMake/include_directories/DebugIncludes-stderr.txt
+++ b/Tests/RunCMake/include_directories/DebugIncludes-stderr.txt
@@ -2,13 +2,6 @@ CMake Warning at DebugIncludes.cmake:8 \(include_directories\):
   Used includes:
 
    \* .*/Tests/RunCMake/include_directories/one
-
-Call Stack \(most recent call first\):
-  CMakeLists.txt:3 \(include\)
-+
-CMake Warning at DebugIncludes.cmake:8 \(include_directories\):
-  Used includes:
-
    \* .*/Tests/RunCMake/include_directories/two
 
 Call Stack \(most recent call first\):

-----------------------------------------------------------------------

Summary of changes:
 Source/cmFLTKWrapUICommand.cxx                     |    6 +-
 Source/cmIncludeDirectoryCommand.cxx               |   88 ++++++++++++--------
 Source/cmIncludeDirectoryCommand.h                 |    3 +-
 Source/cmMakefile.cxx                              |   26 ++++--
 Source/cmMakefile.h                                |    5 +-
 .../include_directories/DebugIncludes-stderr.txt   |    7 --
 6 files changed, 83 insertions(+), 52 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list