From 1a25f057da00f79d9e81c64db87a27061d2ed311 Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 27 Oct 2021 12:58:46 -0400 Subject: cmComputeLinkInformation: Add context to warning about linking a directory --- Source/cmComputeLinkInformation.cxx | 17 +++++++++-------- Source/cmComputeLinkInformation.h | 2 +- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx index 831a81f..2ff91fe 100644 --- a/Source/cmComputeLinkInformation.cxx +++ b/Source/cmComputeLinkInformation.cxx @@ -722,7 +722,7 @@ void cmComputeLinkInformation::AddItem(BT const& item, this->AddFrameworkItem(item.Value); } else if (cmSystemTools::FileIsDirectory(item.Value)) { // This is a directory. - this->DropDirectoryItem(item.Value); + this->DropDirectoryItem(item); } else { // Use the full path given to the library file. this->Depends.push_back(item.Value); @@ -1349,16 +1349,17 @@ void cmComputeLinkInformation::AddFrameworkItem(std::string const& item) } } -void cmComputeLinkInformation::DropDirectoryItem(std::string const& item) +void cmComputeLinkInformation::DropDirectoryItem(BT const& item) { // A full path to a directory was found as a link item. Warn the // user. - std::ostringstream e; - e << "WARNING: Target \"" << this->Target->GetName() - << "\" requests linking to directory \"" << item << "\". " - << "Targets may link only to libraries. " - << "CMake is dropping the item."; - cmSystemTools::Message(e.str()); + this->CMakeInstance->IssueMessage( + MessageType::WARNING, + cmStrCat( + "Target \"", this->Target->GetName(), + "\" requests linking to directory \"", item.Value, + "\". Targets may link only to libraries. CMake is dropping the item."), + item.Backtrace); } void cmComputeLinkInformation::ComputeFrameworkInfo() diff --git a/Source/cmComputeLinkInformation.h b/Source/cmComputeLinkInformation.h index 90a699e..0315540 100644 --- a/Source/cmComputeLinkInformation.h +++ b/Source/cmComputeLinkInformation.h @@ -187,7 +187,7 @@ private: bool CheckImplicitDirItem(std::string const& item); void AddUserItem(BT const& item, bool pathNotKnown); void AddFrameworkItem(std::string const& item); - void DropDirectoryItem(std::string const& item); + void DropDirectoryItem(BT const& item); bool CheckSharedLibNoSOName(std::string const& item); void AddSharedLibNoSOName(std::string const& item); void HandleBadFullItem(std::string const& item, std::string const& file); -- cgit v0.12