Merge topic 'fix-11147-avoid-vc10-filters-error-msg'

0cde56d VS10: Load projects with obj "source" files (#11147)
This commit is contained in:
Brad King 2011-01-26 15:23:37 -05:00 committed by CMake Topic Stage
commit 314ddcbf93
1 changed files with 54 additions and 49 deletions

View File

@ -598,6 +598,10 @@ WriteGroupSources(const char* name,
s != sources.end(); ++s) s != sources.end(); ++s)
{ {
cmSourceFile* sf = *s; cmSourceFile* sf = *s;
if(sf->GetExtension() == "obj")
{
continue;
}
std::string const& source = sf->GetFullPath(); std::string const& source = sf->GetFullPath();
cmSourceGroup& sourceGroup = cmSourceGroup& sourceGroup =
this->Makefile->FindSourceGroup(source.c_str(), sourceGroups); this->Makefile->FindSourceGroup(source.c_str(), sourceGroups);
@ -666,17 +670,19 @@ void cmVisualStudio10TargetGenerator::WriteCLSources()
for(std::vector<cmSourceFile*>::const_iterator source = sources.begin(); for(std::vector<cmSourceFile*>::const_iterator source = sources.begin();
source != sources.end(); ++source) source != sources.end(); ++source)
{ {
// if it is not a custom command then add it as a c/c++ file, std::string ext = (*source)->GetExtension();
// TODO: need to check for idl or rc if((*source)->GetCustomCommand() || ext == "obj")
if(!(*source)->GetCustomCommand())
{ {
continue;
}
// If it is not a custom command and it is not a pre-built obj file,
// then add it as a source (c/c++/header/rc/idl) file
bool header = (*source)->GetPropertyAsBool("HEADER_FILE_ONLY") bool header = (*source)->GetPropertyAsBool("HEADER_FILE_ONLY")
|| this->GlobalGenerator->IgnoreFile || this->GlobalGenerator->IgnoreFile(ext.c_str());
((*source)->GetExtension().c_str());
const char* lang = (*source)->GetLanguage(); const char* lang = (*source)->GetLanguage();
bool cl = lang && (strcmp(lang, "C") == 0 || strcmp(lang, "CXX") ==0); bool cl = lang && (strcmp(lang, "C") == 0 || strcmp(lang, "CXX") ==0);
bool rc = lang && (strcmp(lang, "RC") == 0); bool rc = lang && (strcmp(lang, "RC") == 0);
bool idl = (*source)->GetExtension() == "idl"; bool idl = ext == "idl";
std::string sourceFile = (*source)->GetFullPath(); std::string sourceFile = (*source)->GetFullPath();
sourceFile = cmSystemTools::RelativePath( sourceFile = cmSystemTools::RelativePath(
this->Makefile->GetCurrentOutputDirectory(), this->Makefile->GetCurrentOutputDirectory(),
@ -716,7 +722,6 @@ void cmVisualStudio10TargetGenerator::WriteCLSources()
(*this->BuildFileStream ) << " />\n"; (*this->BuildFileStream ) << " />\n";
} }
} }
}
this->WriteString("</ItemGroup>\n", 1); this->WriteString("</ItemGroup>\n", 1);
} }