[Cmake-commits] CMake branch, next, updated. v2.8.8-2819-ga026199

Alexander Neundorf neundorf at kde.org
Sun May 6 10:35:28 EDT 2012


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  a02619930e10121c29189d6c20da1a7b1d7f9efd (commit)
       via  1f8f58a0b9a7883aedf7a4bcb185e9784db4f13b (commit)
       via  b4a189fd14bd2abf1dba61cd06e540eb8744159e (commit)
      from  d6ff0a7ecad91b20dfb219cc17ab33dd1a940a09 (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=a02619930e10121c29189d6c20da1a7b1d7f9efd
commit a02619930e10121c29189d6c20da1a7b1d7f9efd
Merge: d6ff0a7 1f8f58a
Author:     Alexander Neundorf <neundorf at kde.org>
AuthorDate: Sun May 6 10:35:25 2012 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Sun May 6 10:35:25 2012 -0400

    Merge topic 'FixMultipleResultsInFeatureSummary' into next
    
    1f8f58a fix #13195: avoid multiple mentions of found packages
    b4a189f CMake Nightly Date Stamp


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1f8f58a0b9a7883aedf7a4bcb185e9784db4f13b
commit 1f8f58a0b9a7883aedf7a4bcb185e9784db4f13b
Author:     Alex Neundorf <neundorf at kde.org>
AuthorDate: Sun May 6 16:32:10 2012 +0200
Commit:     Alex Neundorf <neundorf at kde.org>
CommitDate: Sun May 6 16:32:10 2012 +0200

    fix #13195: avoid multiple mentions of found packages
    
    Now before adding a package to the list of found or not-found
    packages, the package is remvoed from both lists before.
    
    Alex

diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx
index 4f9ba7e..be47f95 100644
--- a/Source/cmFindPackageCommand.cxx
+++ b/Source/cmFindPackageCommand.cxx
@@ -1368,41 +1368,73 @@ bool cmFindPackageCommand::ReadListFile(const char* f, PolicyScopeRule psr)
 }
 
 //----------------------------------------------------------------------------
-void cmFindPackageCommand::AppendToProperty(const char* propertyName)
+void cmFindPackageCommand::AppendToFoundProperty(bool found)
 {
-  std::string propertyValue;
-  const char *prop =
-      this->Makefile->GetCMakeInstance()->GetProperty(propertyName);
-  if (prop && *prop)
+  std::vector<std::string> foundContents;
+  const char *foundProp =
+             this->Makefile->GetCMakeInstance()->GetProperty("PACKAGES_FOUND");
+  if (foundProp && *foundProp)
     {
-    propertyValue = prop;
+    std::string tmp = foundProp;
 
-    std::vector<std::string> contents;
-    cmSystemTools::ExpandListArgument(propertyValue, contents, false);
-
-    bool alreadyInserted = false;
-    for(std::vector<std::string>::const_iterator it = contents.begin();
-      it != contents.end(); ++ it )
+    cmSystemTools::ExpandListArgument(tmp, foundContents, false);
+    std::vector<std::string>::iterator nameIt = std::find(
+                       foundContents.begin(), foundContents.end(), this->Name);
+    if(nameIt != foundContents.end())
       {
-      if (*it == this->Name)
-        {
-        alreadyInserted = true;
-        break;
-        }
+      foundContents.erase(nameIt);
       }
-    if (!alreadyInserted)
+    }
+
+  std::vector<std::string> notFoundContents;
+  const char *notFoundProp =
+         this->Makefile->GetCMakeInstance()->GetProperty("PACKAGES_NOT_FOUND");
+  if (notFoundProp && *notFoundProp)
+    {
+    std::string tmp = notFoundProp;
+
+    cmSystemTools::ExpandListArgument(tmp, notFoundContents, false);
+    std::vector<std::string>::iterator nameIt = std::find(
+                 notFoundContents.begin(), notFoundContents.end(), this->Name);
+    if(nameIt != notFoundContents.end())
       {
-      propertyValue += ";";
-      propertyValue += this->Name;
+      notFoundContents.erase(nameIt);
       }
     }
+
+  if(found)
+    {
+    foundContents.push_back(this->Name);
+    }
   else
     {
-    propertyValue = this->Name;
+    notFoundContents.push_back(this->Name);
+    }
+
+
+  std::string tmp;
+  const char* sep ="";
+  for(size_t i=0; i<foundContents.size(); i++)
+    {
+    tmp += sep;
+    tmp += foundContents[i];
+    sep = ";";
+    }
+
+  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 = ";";
     }
-  this->Makefile->GetCMakeInstance()->SetProperty(propertyName,
-                                                  propertyValue.c_str());
- }
+  this->Makefile->GetCMakeInstance()->SetProperty("PACKAGES_NOT_FOUND",
+                                                  tmp.c_str());
+}
 
 //----------------------------------------------------------------------------
 void cmFindPackageCommand::AppendSuccessInformation()
@@ -1413,14 +1445,10 @@ void cmFindPackageCommand::AppendSuccessInformation()
 
   const char* upperResult = this->Makefile->GetDefinition(upperFound.c_str());
   const char* result = this->Makefile->GetDefinition(found.c_str());
-  if ((cmSystemTools::IsOn(result)) || (cmSystemTools::IsOn(upperResult)))
-    {
-    this->AppendToProperty("PACKAGES_FOUND");
-    }
-  else
-    {
-    this->AppendToProperty("PACKAGES_NOT_FOUND");
-    }
+  bool packageFound = ((cmSystemTools::IsOn(result))
+                                        || (cmSystemTools::IsOn(upperResult)));
+
+  this->AppendToFoundProperty(packageFound);
 
   // Record whether the find was quiet or not, so this can be used
   // e.g. in FeatureSummary.cmake
diff --git a/Source/cmFindPackageCommand.h b/Source/cmFindPackageCommand.h
index edb70a6..c380122 100644
--- a/Source/cmFindPackageCommand.h
+++ b/Source/cmFindPackageCommand.h
@@ -69,7 +69,7 @@ protected:
   virtual void GenerateDocumentation();
 private:
   void AppendSuccessInformation();
-  void AppendToProperty(const char* propertyName);
+  void AppendToFoundProperty(bool found);
   void SetModuleVariables(const std::string& components);
   bool FindModule(bool& found);
   void AddFindDefinition(const char* var, const char* val);

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

Summary of changes:
 Source/CMakeVersion.cmake       |    2 +-
 Source/cmFindPackageCommand.cxx |   92 +++++++++++++++++++++++++-------------
 Source/cmFindPackageCommand.h   |    2 +-
 3 files changed, 62 insertions(+), 34 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list