From 76724c23bff8b5adcded34f73a4d18123b8b1fe8 Mon Sep 17 00:00:00 2001 From: Bill Hoffman Date: Tue, 22 Nov 2005 16:08:16 -0500 Subject: [PATCH] BUG: fix for bug 2357, do not allow targets to link to directories --- Source/cmOrderLinkDirectories.cxx | 11 +++++++++++ Source/cmOrderLinkDirectories.h | 2 ++ 2 files changed, 13 insertions(+) diff --git a/Source/cmOrderLinkDirectories.cxx b/Source/cmOrderLinkDirectories.cxx index 446b3ed62..b0e0d6bd3 100644 --- a/Source/cmOrderLinkDirectories.cxx +++ b/Source/cmOrderLinkDirectories.cxx @@ -225,6 +225,7 @@ void cmOrderLinkDirectories::SetLinkInformation(cmTarget& target, linktype, const char* targetLibrary) { + m_TargetName = target.GetName(); // collect the search paths from the target into paths set const std::vector& searchPaths = target.GetLinkDirectories(); std::vector empty; @@ -279,6 +280,16 @@ bool cmOrderLinkDirectories::DetermineLibraryPathOrder() std::vector empty; for(unsigned int i=0; i < m_RawLinkItems.size(); ++i) { + if(cmSystemTools::FileIsDirectory(m_RawLinkItems[i].c_str())) + { + std::string message = "Warning: Ignoring path found in link libraries for target: "; + message += m_TargetName; + message += ", path is: "; + message += m_RawLinkItems[i]; + message += ". Expected a library name or a full path to a library name."; + cmSystemTools::Message(message.c_str()); + continue; + } if(cmSystemTools::FileIsFullPath(m_RawLinkItems[i].c_str())) { cmSystemTools::SplitProgramPath(m_RawLinkItems[i].c_str(), diff --git a/Source/cmOrderLinkDirectories.h b/Source/cmOrderLinkDirectories.h index b51408164..b70dcf826 100644 --- a/Source/cmOrderLinkDirectories.h +++ b/Source/cmOrderLinkDirectories.h @@ -129,6 +129,8 @@ private: cmStdString m_LinkPrefix; // set of directories that can not be put in the correct order std::set m_ImposibleDirectories; + // Name of target + cmStdString m_TargetName; // library regular expressions cmsys::RegularExpression m_RemoveLibraryExtension; cmsys::RegularExpression m_ExtractBaseLibraryName;