summaryrefslogtreecommitdiffstats
path: root/Source/cmVisualStudio10TargetGenerator.cxx
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2009-10-22 01:30:41 (GMT)
committerBill Hoffman <bill.hoffman@kitware.com>2009-10-22 01:30:41 (GMT)
commit7c06e91c9c308274797fcf0ff911a684dc697387 (patch)
treea83530c6a6e04700684c65ef9909f3523fde9726 /Source/cmVisualStudio10TargetGenerator.cxx
parentb8464a066ecf8b8b0c346f0230d28d85d5924458 (diff)
downloadCMake-7c06e91c9c308274797fcf0ff911a684dc697387.zip
CMake-7c06e91c9c308274797fcf0ff911a684dc697387.tar.gz
CMake-7c06e91c9c308274797fcf0ff911a684dc697387.tar.bz2
Fix for bugs #9756, #9690 and #9755, header files were not included, and link_directories we incorrect
Diffstat (limited to 'Source/cmVisualStudio10TargetGenerator.cxx')
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx33
1 files 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<cmSourceFile*> clCompile;
std::vector<cmSourceFile*> customBuild;
std::vector<cmSourceFile*> none;
+ std::vector<cmSourceFile*> headers;
for(std::vector<cmSourceFile*>::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("<ItemGroup>\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("<ClCompile Include=\"", 2);
+ if(header)
+ {
+ this->WriteString("<ClInclude Include=\"", 2);
+ }
+ else
+ {
+ this->WriteString("<ClCompile Include=\"", 2);
+ }
(*this->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());