summaryrefslogtreecommitdiffstats
path: root/Source/cmComputeLinkInformation.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2008-07-21 14:07:56 (GMT)
committerBrad King <brad.king@kitware.com>2008-07-21 14:07:56 (GMT)
commitff63bb1b4441e8ef2eb2eb3cfa65cc5125e0b462 (patch)
tree95dee76c0fc82860fc85c89c44ea48502389ea6c /Source/cmComputeLinkInformation.cxx
parentdbb89f47aa2bcffe023fc1f2e23cb5466c331b17 (diff)
downloadCMake-ff63bb1b4441e8ef2eb2eb3cfa65cc5125e0b462.zip
CMake-ff63bb1b4441e8ef2eb2eb3cfa65cc5125e0b462.tar.gz
CMake-ff63bb1b4441e8ef2eb2eb3cfa65cc5125e0b462.tar.bz2
ENH: Support full-path libs w/out extension in VS IDE.
- This case worked accidentally in CMake 2.4, though not in Makefiles. - Some projects build only with the VS IDE on windows and have this mistake. - Support them when 2.4 compatibility is enabled by adding the extension.
Diffstat (limited to 'Source/cmComputeLinkInformation.cxx')
-rw-r--r--Source/cmComputeLinkInformation.cxx41
1 files changed, 40 insertions, 1 deletions
diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx
index b133e35..87157a7 100644
--- a/Source/cmComputeLinkInformation.cxx
+++ b/Source/cmComputeLinkInformation.cxx
@@ -1078,8 +1078,47 @@ void cmComputeLinkInformation::AddFullItem(std::string const& item)
this->Items.push_back(Item(this->LibLinkFileFlag, false));
}
+ // Full path libraries should have an extension. CMake 2.4 would
+ // add the extension after splitting the file off of the directory.
+ // Some existing projects depended on this to build correctly
+ // because they left off the extension of an otherwise full-path
+ // library. This worked with CMake 2.4 but only for VS IDE builds
+ // because the file-level dependency added to the Makefile would not
+ // be found. Nevertheless, some projects have this mistake but work
+ // because they build only with the VS IDE. We need to support them
+ // here by adding the missing extension.
+ std::string final_item = item;
+ if(strstr(this->GlobalGenerator->GetName(), "Visual Studio") &&
+ this->Makefile->NeedBackwardsCompatibility(2,4) &&
+ !cmSystemTools::ComparePath(
+ cmSystemTools::GetFilenameLastExtension(item).c_str(),
+ this->LibLinkSuffix.c_str()))
+ {
+ // Issue the warning at most once.
+ std::string wid = "VSIDE-LINK-EXT-";
+ wid += item;
+ if(!this->Target->GetPropertyAsBool(wid.c_str()))
+ {
+ this->Target->SetProperty(wid.c_str(), "1");
+ cmOStringStream w;
+ w << "Target \"" << this->Target->GetName() << "\" links to "
+ << "full-path item\n"
+ << " " << item << "\n"
+ << "which does not have the proper link extension \""
+ << this->LibLinkSuffix << "\". "
+ << "CMake is adding the missing extension because compatibility "
+ << "with CMake 2.4 is currently enabled and this case worked "
+ << "accidentally in that version. "
+ << "The link extension should be added by the project developer.";
+ this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, w.str());
+ }
+
+ // Add the missing extension.
+ final_item += this->LibLinkSuffix;
+ }
+
// Now add the full path to the library.
- this->Items.push_back(Item(item, true));
+ this->Items.push_back(Item(final_item, true));
}
//----------------------------------------------------------------------------