ENH: Provide context in path ordering warnings

This commit is contained in:
Brad King 2008-07-29 14:01:04 -04:00
parent 478fbdfc23
commit 01d143c77b
3 changed files with 16 additions and 12 deletions

View File

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

View File

@ -18,6 +18,7 @@
#include "cmGlobalGenerator.h" #include "cmGlobalGenerator.h"
#include "cmSystemTools.h" #include "cmSystemTools.h"
#include "cmake.h"
#include <assert.h> #include <assert.h>
@ -239,11 +240,11 @@ bool cmOrderDirectoriesConstraintLibrary::FindConflict(std::string const& dir)
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
cmOrderDirectories::cmOrderDirectories(cmGlobalGenerator* gg, cmOrderDirectories::cmOrderDirectories(cmGlobalGenerator* gg,
const char* name, cmTarget* target,
const char* purpose) const char* purpose)
{ {
this->GlobalGenerator = gg; this->GlobalGenerator = gg;
this->Name = name; this->Target = target;
this->Purpose = purpose; this->Purpose = purpose;
this->Computed = false; this->Computed = false;
} }
@ -510,22 +511,24 @@ void cmOrderDirectories::DiagnoseCycle()
// Construct the message. // Construct the message.
cmOStringStream e; cmOStringStream e;
e << "WARNING: Cannot generate a safe " << this->Purpose e << "Cannot generate a safe " << this->Purpose
<< " for target " << this->Name << " for target " << this->Target->GetName()
<< " because there is a cycle in the constraint graph:\n"; << " because there is a cycle in the constraint graph:\n";
// Display the conflict graph. // Display the conflict graph.
for(unsigned int i=0; i < this->ConflictGraph.size(); ++i) for(unsigned int i=0; i < this->ConflictGraph.size(); ++i)
{ {
ConflictList const& clist = this->ConflictGraph[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(); for(ConflictList::const_iterator j = clist.begin();
j != clist.end(); ++j) 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); this->ConstraintEntries[j->second]->Report(e);
e << "\n"; 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());
} }

View File

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