summaryrefslogtreecommitdiffstats
path: root/Source/cmComputeLinkInformation.cxx
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2008-03-18 21:32:26 (GMT)
committerBill Hoffman <bill.hoffman@kitware.com>2008-03-18 21:32:26 (GMT)
commitba7f0ab335de572b9dafe9a7ba03f371db294128 (patch)
tree37ea259b5fd00ad72f7e3b841c20d95ac52111f4 /Source/cmComputeLinkInformation.cxx
parentcaa6de5b898c0a756ae34cba578343cca3956d56 (diff)
downloadCMake-ba7f0ab335de572b9dafe9a7ba03f371db294128.zip
CMake-ba7f0ab335de572b9dafe9a7ba03f371db294128.tar.gz
CMake-ba7f0ab335de572b9dafe9a7ba03f371db294128.tar.bz2
ENH: try to reduce the number of CMP0003 warnings that people see. Only report them for unique sets of libraries with no full path. Also add a message explaining the course of action that should be taken
Diffstat (limited to 'Source/cmComputeLinkInformation.cxx')
-rw-r--r--Source/cmComputeLinkInformation.cxx32
1 files changed, 24 insertions, 8 deletions
diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx
index 6944298..00679f4 100644
--- a/Source/cmComputeLinkInformation.cxx
+++ b/Source/cmComputeLinkInformation.cxx
@@ -1338,9 +1338,18 @@ bool cmComputeLinkInformation::FinishLinkerSearchDirectories()
cmOStringStream w;
w << (this->Makefile->GetPolicies()
->GetPolicyWarning(cmPolicies::CMP0003)) << "\n";
- this->PrintLinkPolicyDiagnosis(w);
- this->CMakeInstance->IssueMessage(cmake::AUTHOR_WARNING, w.str(),
- this->Target->GetBacktrace());
+ std::string libs = "CMP0003-WARNING-FOR-";
+ this->PrintLinkPolicyDiagnosis(w, libs);
+ const char* def = this->CMakeInstance->GetCacheDefinition(libs.c_str());
+ if(!def)
+ {
+ this->CMakeInstance->IssueMessage(cmake::AUTHOR_WARNING, w.str(),
+ this->Target->GetBacktrace());
+ this->CMakeInstance->AddCacheEntry(libs.c_str(),
+ "TRUE",
+ "",
+ cmCacheManager::INTERNAL);
+ }
}
case cmPolicies::OLD:
// OLD behavior is to add the paths containing libraries with
@@ -1355,7 +1364,8 @@ bool cmComputeLinkInformation::FinishLinkerSearchDirectories()
cmOStringStream e;
e << (this->Makefile->GetPolicies()->
GetRequiredPolicyError(cmPolicies::CMP0003)) << "\n";
- this->PrintLinkPolicyDiagnosis(e);
+ std::string libs;
+ this->PrintLinkPolicyDiagnosis(e, libs);
this->CMakeInstance->IssueMessage(cmake::FATAL_ERROR, e.str(),
this->Target->GetBacktrace());
return false;
@@ -1373,8 +1383,13 @@ bool cmComputeLinkInformation::FinishLinkerSearchDirectories()
}
//----------------------------------------------------------------------------
-void cmComputeLinkInformation::PrintLinkPolicyDiagnosis(std::ostream& os)
+void cmComputeLinkInformation::PrintLinkPolicyDiagnosis(std::ostream& os,
+ std::string& libs)
{
+ os << "The best way to remove this warning is to set policy CMP0003 "
+ << "to NEW. Then, try to build the project, if you get linker errors, "
+ << "either use the full paths to the libraries that can not be "
+ << "found, or use link_directories to add the missing directories.\n";
// Name the target.
os << "Target \"" << this->Target->GetName() << "\" ";
@@ -1416,7 +1431,7 @@ void cmComputeLinkInformation::PrintLinkPolicyDiagnosis(std::ostream& os)
}
line += sep;
line += *i;
-
+ libs += *i;
// Convert to the other separator.
sep = ", ";
}
@@ -1427,12 +1442,13 @@ void cmComputeLinkInformation::PrintLinkPolicyDiagnosis(std::ostream& os)
}
// Tell the user what is wrong.
- os << "The linker will search for libraries in the second list. "
+ os << "This maybe OK as well. However, the linker will search "
+ << "for libraries in the second list. "
<< "Finding them may depend on linker search paths earlier CMake "
<< "versions added as an implementation detail for linking to the "
<< "libraries in the first list. "
<< "For compatibility CMake is including the extra linker search "
- << "paths, but policy CMP0003 should be set by the project.";
+ << "paths, but policy CMP0003 should be set by the project. ";
}
//----------------------------------------------------------------------------