CMP0008: Remove support for OLD behavior
This commit is contained in:
parent
d77a7e8d1c
commit
43ef139567
@ -1,6 +1,9 @@
|
||||
CMP0008
|
||||
-------
|
||||
|
||||
.. |REMOVED_IN_CMAKE_VERSION| replace:: 4.0
|
||||
.. include:: REMOVED_PROLOGUE.txt
|
||||
|
||||
Libraries linked by full-path must have a valid library file name.
|
||||
|
||||
In CMake 2.4 and below it is possible to write code like
|
||||
@ -29,7 +32,5 @@ it. The ``NEW`` behavior for this policy is to trust the given path and
|
||||
pass it directly to the native build tool unchanged.
|
||||
|
||||
.. |INTRODUCED_IN_CMAKE_VERSION| replace:: 2.6.1
|
||||
.. |WARNS_OR_DOES_NOT_WARN| replace:: warns
|
||||
.. include:: STANDARD_ADVICE.txt
|
||||
|
||||
.. include:: DEPRECATED.txt
|
||||
.. |WARNED_OR_DID_NOT_WARN| replace:: warned
|
||||
.. include:: REMOVED_EPILOGUE.txt
|
||||
|
@ -1711,19 +1711,6 @@ void cmComputeLinkInformation::AddFullItem(LinkEntry const& entry)
|
||||
return;
|
||||
}
|
||||
|
||||
// Full path libraries should specify a valid library file name.
|
||||
// See documentation of CMP0008.
|
||||
std::string generator = this->GlobalGenerator->GetName();
|
||||
if (this->Target->GetPolicyStatusCMP0008() != cmPolicies::NEW &&
|
||||
(generator.find("Visual Studio") != std::string::npos ||
|
||||
generator.find("Xcode") != std::string::npos)) {
|
||||
std::string file = cmSystemTools::GetFilenameName(item.Value);
|
||||
if (!this->ExtractAnyLibraryName.find(file)) {
|
||||
this->HandleBadFullItem(entry, file);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// This is called to handle a link item that is a full path.
|
||||
// If the target is not a static library make sure the link type is
|
||||
// shared. This is because dynamic-mode linking can handle both
|
||||
@ -2088,51 +2075,6 @@ void cmComputeLinkInformation::AddSharedLibNoSOName(LinkEntry const& entry)
|
||||
this->OrderLinkerSearchPath->AddLinkLibrary(entry.Item.Value);
|
||||
}
|
||||
|
||||
void cmComputeLinkInformation::HandleBadFullItem(LinkEntry const& entry,
|
||||
std::string const& file)
|
||||
{
|
||||
std::string const& item = entry.Item.Value;
|
||||
// Do not depend on things that do not exist.
|
||||
auto i = std::find(this->Depends.begin(), this->Depends.end(), item);
|
||||
if (i != this->Depends.end()) {
|
||||
this->Depends.erase(i);
|
||||
}
|
||||
|
||||
// Tell the linker to search for the item and provide the proper
|
||||
// path for it.
|
||||
LinkEntry fileEntry{ entry };
|
||||
fileEntry.Item = file;
|
||||
this->AddUserItem(fileEntry);
|
||||
this->OrderLinkerSearchPath->AddLinkLibrary(item);
|
||||
|
||||
// Produce any needed message.
|
||||
switch (this->Target->GetPolicyStatusCMP0008()) {
|
||||
case cmPolicies::WARN: {
|
||||
// Print the warning at most once for this item.
|
||||
std::string wid = cmStrCat("CMP0008-WARNING-GIVEN-", item);
|
||||
if (!this->CMakeInstance->GetState()->GetGlobalPropertyAsBool(wid)) {
|
||||
this->CMakeInstance->GetState()->SetGlobalProperty(wid, "1");
|
||||
std::ostringstream w;
|
||||
/* clang-format off */
|
||||
w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0008) << "\n"
|
||||
"Target \"" << this->Target->GetName() << "\" links to item\n"
|
||||
" " << item << "\n"
|
||||
"which is a full-path but not a valid library file name.";
|
||||
/* clang-format on */
|
||||
this->CMakeInstance->IssueMessage(MessageType::AUTHOR_WARNING, w.str(),
|
||||
this->Target->GetBacktrace());
|
||||
}
|
||||
}
|
||||
CM_FALLTHROUGH;
|
||||
case cmPolicies::OLD: // NOLINT(bugprone-branch-clone)
|
||||
// OLD behavior does not warn.
|
||||
break;
|
||||
case cmPolicies::NEW:
|
||||
// NEW behavior will not get here.
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void cmComputeLinkInformation::LoadImplicitLinkInfo()
|
||||
{
|
||||
// Get platform-wide implicit directories.
|
||||
|
@ -215,7 +215,6 @@ private:
|
||||
void DropDirectoryItem(BT<std::string> const& item);
|
||||
bool CheckSharedLibNoSOName(LinkEntry const& entry);
|
||||
void AddSharedLibNoSOName(LinkEntry const& entry);
|
||||
void HandleBadFullItem(LinkEntry const& entry, std::string const& file);
|
||||
|
||||
// Framework info.
|
||||
void ComputeFrameworkInfo();
|
||||
|
@ -39,7 +39,7 @@ class cmMakefile;
|
||||
SELECT( \
|
||||
POLICY, CMP0008, \
|
||||
"Libraries linked by full-path must have a valid library file name.", 2, \
|
||||
6, 1, WARN) \
|
||||
6, 1, NEW) \
|
||||
SELECT(POLICY, CMP0009, \
|
||||
"FILE GLOB_RECURSE calls should not follow symlinks by default.", 2, \
|
||||
6, 2, WARN) \
|
||||
|
Loading…
Reference in New Issue
Block a user