Browse Source

ENH: Provide context in path ordering warnings

Brad King 17 years ago
parent
commit
01d143c77b
3 changed files with 16 additions and 12 deletions
  1. 3 3
      Source/cmComputeLinkInformation.cxx
  2. 10 7
      Source/cmOrderDirectories.cxx
  3. 3 2
      Source/cmOrderDirectories.h

+ 3 - 3
Source/cmComputeLinkInformation.cxx

@@ -256,10 +256,10 @@ cmComputeLinkInformation
 
   // Allocate internals.
   this->OrderLinkerSearchPath =
-    new cmOrderDirectories(this->GlobalGenerator, target->GetName(),
+    new cmOrderDirectories(this->GlobalGenerator, target,
                            "linker search path");
   this->OrderRuntimeSearchPath =
-    new cmOrderDirectories(this->GlobalGenerator, target->GetName(),
+    new cmOrderDirectories(this->GlobalGenerator, target,
                            "runtime search path");
   this->OrderDependentRPath = 0;
 
@@ -362,7 +362,7 @@ cmComputeLinkInformation
     {
     this->SharedDependencyMode = SharedDepModeDir;
     this->OrderDependentRPath =
-      new cmOrderDirectories(this->GlobalGenerator, target->GetName(),
+      new cmOrderDirectories(this->GlobalGenerator, target,
                              "dependent library path");
     }
 

+ 10 - 7
Source/cmOrderDirectories.cxx

@@ -18,6 +18,7 @@
 
 #include "cmGlobalGenerator.h"
 #include "cmSystemTools.h"
+#include "cmake.h"
 
 #include <assert.h>
 
@@ -239,11 +240,11 @@ bool cmOrderDirectoriesConstraintLibrary::FindConflict(std::string const& dir)
 
 //----------------------------------------------------------------------------
 cmOrderDirectories::cmOrderDirectories(cmGlobalGenerator* gg,
-                                       const char* name,
+                                       cmTarget* target,
                                        const char* purpose)
 {
   this->GlobalGenerator = gg;
-  this->Name = name;
+  this->Target = target;
   this->Purpose = purpose;
   this->Computed = false;
 }
@@ -510,22 +511,24 @@ void cmOrderDirectories::DiagnoseCycle()
 
   // Construct the message.
   cmOStringStream e;
-  e << "WARNING: Cannot generate a safe " << this->Purpose
-    << " for target " << this->Name
+  e << "Cannot generate a safe " << this->Purpose
+    << " for target " << this->Target->GetName()
     << " because there is a cycle in the constraint graph:\n";
 
   // Display the conflict graph.
   for(unsigned int i=0; i < this->ConflictGraph.size(); ++i)
     {
     ConflictList const& clist = this->ConflictGraph[i];
-    e << "dir " << i << " is [" << this->OriginalDirectories[i] << "]\n";
+    e << "  dir " << i << " is [" << this->OriginalDirectories[i] << "]\n";
     for(ConflictList::const_iterator j = clist.begin();
         j != clist.end(); ++j)
       {
-      e << "  dir " << j->first << " must precede it due to ";
+      e << "    dir " << j->first << " must precede it due to ";
       this->ConstraintEntries[j->second]->Report(e);
       e << "\n";
       }
     }
-  cmSystemTools::Message(e.str().c_str());
+  e << "Some of these libraries may not be found correctly.";
+  this->GlobalGenerator->GetCMakeInstance()
+    ->IssueMessage(cmake::WARNING, e.str(), this->Target->GetBacktrace());
 }

+ 3 - 2
Source/cmOrderDirectories.h

@@ -24,6 +24,7 @@
 class cmGlobalGenerator;
 class cmOrderDirectoriesConstraint;
 class cmOrderDirectoriesConstraintLibrary;
+class cmTarget;
 
 /** \class cmOrderDirectories
  * \brief Compute a safe runtime path order for a set of shared libraries.
@@ -31,7 +32,7 @@ class cmOrderDirectoriesConstraintLibrary;
 class cmOrderDirectories
 {
 public:
-  cmOrderDirectories(cmGlobalGenerator* gg, const char* name,
+  cmOrderDirectories(cmGlobalGenerator* gg, cmTarget* target,
                      const char* purpose);
   ~cmOrderDirectories();
   void AddRuntimeLibrary(std::string const& fullPath, const char* soname = 0);
@@ -44,7 +45,7 @@ public:
   std::vector<std::string> const& GetOrderedDirectories();
 private:
   cmGlobalGenerator* GlobalGenerator;
-  std::string Name;
+  cmTarget* Target;
   std::string Purpose;
 
   bool Computed;