diff --git a/Help/policy/CMP0008.rst b/Help/policy/CMP0008.rst index bcb10d5f35..d2c95f2ce6 100644 --- a/Help/policy/CMP0008.rst +++ b/Help/policy/CMP0008.rst @@ -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 diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx index aaa9a42360..db589e1665 100644 --- a/Source/cmComputeLinkInformation.cxx +++ b/Source/cmComputeLinkInformation.cxx @@ -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. diff --git a/Source/cmComputeLinkInformation.h b/Source/cmComputeLinkInformation.h index c070cd5639..98f6e7ebd7 100644 --- a/Source/cmComputeLinkInformation.h +++ b/Source/cmComputeLinkInformation.h @@ -215,7 +215,6 @@ private: void DropDirectoryItem(BT 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(); diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index 0928f7c07c..21527fca3d 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -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) \