From 7c06e91c9c308274797fcf0ff911a684dc697387 Mon Sep 17 00:00:00 2001 From: Bill Hoffman Date: Wed, 21 Oct 2009 21:30:41 -0400 Subject: Fix for bugs #9756, #9690 and #9755, header files were not included, and link_directories we incorrect --- Source/cmVisualStudio10TargetGenerator.cxx | 33 ++++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 43a78ca..74a6df4 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -375,6 +375,7 @@ void cmVisualStudio10TargetGenerator::WriteGroups() std::vector clCompile; std::vector customBuild; std::vector none; + std::vector headers; for(std::vector::const_iterator s = classes.begin(); s != classes.end(); s++) @@ -384,7 +385,10 @@ void cmVisualStudio10TargetGenerator::WriteGroups() cmSourceGroup& sourceGroup = this->Makefile->FindSourceGroup(source.c_str(), sourceGroups); groupsUsed.insert(&sourceGroup); - const char* lang = sf->GetLanguage(); + const char* lang = sf->GetLanguage(); + bool header = (*s)->GetPropertyAsBool("HEADER_FILE_ONLY") + || this->GlobalGenerator->IgnoreFile + ((*s)->GetExtension().c_str()); if(!lang) { lang = "None"; @@ -397,6 +401,10 @@ void cmVisualStudio10TargetGenerator::WriteGroups() { customBuild.push_back(sf); } + else if(header) + { + headers.push_back(sf); + } else { none.push_back(sf); @@ -419,6 +427,7 @@ void cmVisualStudio10TargetGenerator::WriteGroups() "developer/msbuild/2003\">\n", 0); this->WriteGroupSources("ClCompile", clCompile, sourceGroups); + this->WriteGroupSources("ClInclude", headers, sourceGroups); this->WriteGroupSources("CustomBuild", customBuild, sourceGroups); this->WriteString("\n", 1); @@ -532,13 +541,13 @@ void cmVisualStudio10TargetGenerator::WriteCLSources() { // if it is not a custom command then add it as a c/c++ file, // TODO: need to check for idl or rc - if(!(*source)->GetCustomCommand() - && !(*source)->GetPropertyAsBool("HEADER_FILE_ONLY") - && !this->GlobalGenerator->IgnoreFile - ((*source)->GetExtension().c_str())) + if(!(*source)->GetCustomCommand()) { + bool header = (*source)->GetPropertyAsBool("HEADER_FILE_ONLY") + || this->GlobalGenerator->IgnoreFile + ((*source)->GetExtension().c_str()); const char* lang = (*source)->GetLanguage(); - if(lang && (strcmp(lang, "C") == 0 || strcmp(lang, "CXX") ==0)) + if(header || lang && (strcmp(lang, "C") == 0 || strcmp(lang, "CXX") ==0)) { std::string sourceFile = (*source)->GetFullPath(); sourceFile = cmSystemTools::RelativePath( @@ -546,7 +555,14 @@ void cmVisualStudio10TargetGenerator::WriteCLSources() sourceFile.c_str()); this->ConvertToWindowsSlash(sourceFile); // output the source file - this->WriteString("WriteString("WriteString("BuildFileStream ) << sourceFile << "\""; // ouput any flags specific to this source file if(this->OutputSourceSpecificFlags(*source)) @@ -1080,11 +1096,12 @@ void cmVisualStudio10TargetGenerator::WriteLinkOptions(std::string const& // first just full path linkDirs += sep; linkDirs += *d; + sep = ";"; linkDirs += sep; // next path with configuration type Debug, Release, etc linkDirs += *d; linkDirs += "/$(Configuration)"; - sep = ";"; + linkDirs += sep; } linkDirs += "%(AdditionalLibraryDirectories)"; linkOptions.AddFlag("AdditionalLibraryDirectories", linkDirs.c_str()); -- cgit v0.12