summaryrefslogtreecommitdiff
path: root/Source/cmLocalVisualStudio7Generator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2017-04-10 14:50:53 -0400
committerBrad King <brad.king@kitware.com>2017-04-11 10:10:28 -0400
commitf4af14add40d851f7c8ef92aad2d549dcbbacf1f (patch)
treefe4002f1881a73bb8419d4fe5331e487afd762d4 /Source/cmLocalVisualStudio7Generator.cxx
parent10772c51b4b0eea35d78a2dd3aa45b92daab7ef2 (diff)
downloadcmake-f4af14add40d851f7c8ef92aad2d549dcbbacf1f.tar.gz
VS: Simplify logic collecting object library files as sources
Object library files are already included by `GetExternalObjects` and `GetConfigCommonSourceFiles` so we don't need to call `UseObjectLibraries` to get them.
Diffstat (limited to 'Source/cmLocalVisualStudio7Generator.cxx')
-rw-r--r--Source/cmLocalVisualStudio7Generator.cxx47
1 files changed, 21 insertions, 26 deletions
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index 260a84bbfe..9e83c7766f 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -1306,14 +1306,21 @@ void cmLocalVisualStudio7GeneratorInternals::OutputObjects(
// list object library content on the link line instead.
cmLocalVisualStudio7Generator* lg = this->LocalGenerator;
std::string currentBinDir = lg->GetCurrentBinaryDirectory();
- std::vector<std::string> objs;
- gt->UseObjectLibraries(objs, "");
+
+ std::vector<cmSourceFile*> sources;
+ if (!gt->GetConfigCommonSourceFiles(sources)) {
+ return;
+ }
+
const char* sep = isep ? isep : "";
- for (std::vector<std::string>::const_iterator oi = objs.begin();
- oi != objs.end(); ++oi) {
- std::string rel = lg->ConvertToRelativePath(currentBinDir, oi->c_str());
- fout << sep << lg->ConvertToXMLOutputPath(rel.c_str());
- sep = " ";
+ for (std::vector<cmSourceFile*>::const_iterator i = sources.begin();
+ i != sources.end(); i++) {
+ if (!(*i)->GetObjectLibrary().empty()) {
+ std::string const& objFile = (*i)->GetFullPath();
+ std::string rel = lg->ConvertToRelativePath(currentBinDir, objFile);
+ fout << sep << lg->ConvertToXMLOutputPath(rel.c_str());
+ sep = " ";
+ }
}
}
@@ -1370,7 +1377,13 @@ void cmLocalVisualStudio7Generator::WriteVCProjFile(std::ostream& fout,
for (std::vector<cmSourceFile*>::const_iterator i = classes.begin();
i != classes.end(); i++) {
if (!(*i)->GetObjectLibrary().empty()) {
- continue;
+ if (this->GetVersion() < cmGlobalVisualStudioGenerator::VS8 ||
+ this->FortranProject) {
+ // VS < 8 does not support per-config source locations so we
+ // list object library content on the link line instead.
+ // See OutputObjects.
+ continue;
+ }
}
// Add the file to the list of sources.
std::string source = (*i)->GetFullPath();
@@ -1392,24 +1405,6 @@ void cmLocalVisualStudio7Generator::WriteVCProjFile(std::ostream& fout,
this->WriteGroup(&sg, target, fout, libName, configs);
}
- if (this->GetVersion() >= cmGlobalVisualStudioGenerator::VS8 &&
- !this->FortranProject) {
- // VS >= 8 support per-config source locations so we
- // list object library content as external objects.
- std::vector<std::string> objs;
- target->UseObjectLibraries(objs, "");
- if (!objs.empty()) {
- // TODO: Separate sub-filter for each object library used?
- fout << "\t\t<Filter Name=\"Object Libraries\">\n";
- for (std::vector<std::string>::const_iterator oi = objs.begin();
- oi != objs.end(); ++oi) {
- std::string o = this->ConvertToXMLOutputPathSingle(oi->c_str());
- fout << "\t\t\t<File RelativePath=\"" << o << "\" />\n";
- }
- fout << "\t\t</Filter>\n";
- }
- }
-
fout << "\t</Files>\n";
// Write the VCProj file's footer.