summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2014-08-13 18:09:24 (GMT)
committerBrad King <brad.king@kitware.com>2014-08-13 18:09:24 (GMT)
commit5fcb42ab69b030f8bbc20f800b1e0639c5ee7077 (patch)
tree9ad382082675d242cd2d1f804d5de54bd66a617d
parent8e026aa7f27aaa545b6421e61d7ba3add1c5d10d (diff)
downloadCMake-5fcb42ab69b030f8bbc20f800b1e0639c5ee7077.zip
CMake-5fcb42ab69b030f8bbc20f800b1e0639c5ee7077.tar.gz
CMake-5fcb42ab69b030f8bbc20f800b1e0639c5ee7077.tar.bz2
VS: Refactor include directory generation in .vcxproj files
Use the cmVisualStudioGeneratorOptions flag map to add the AdditionalIncludeDirectories element to the project file. Move appending of %(AdditionalIncludeDirectories) to the locations that populate the flag vectors instead of where they are written out.
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx37
-rw-r--r--Source/cmVisualStudio10TargetGenerator.h1
-rw-r--r--Source/cmVisualStudioGeneratorOptions.cxx4
3 files changed, 19 insertions, 23 deletions
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index 5ad63b5..3c7745d 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -1305,6 +1305,11 @@ bool cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags(
clOptions.AddFlag("CompileAs", compileAs);
}
clOptions.Parse(flags.c_str());
+ if(clOptions.HasFlag("AdditionalIncludeDirectories"))
+ {
+ clOptions.AppendFlag("AdditionalIncludeDirectories",
+ "%(AdditionalIncludeDirectories)");
+ }
clOptions.AddDefines(configDefines.c_str());
clOptions.SetConfiguration((*config).c_str());
clOptions.OutputAdditionalOptions(*this->BuildFileStream, " ", "");
@@ -1546,7 +1551,9 @@ void cmVisualStudio10TargetGenerator::WriteClOptions(
Options& clOptions = *(this->ClOptions[configName]);
this->WriteString("<ClCompile>\n", 2);
clOptions.OutputAdditionalOptions(*this->BuildFileStream, " ", "");
- this->OutputIncludes(includes);
+ clOptions.AppendFlag("AdditionalIncludeDirectories", includes);
+ clOptions.AppendFlag("AdditionalIncludeDirectories",
+ "%(AdditionalIncludeDirectories)");
clOptions.OutputFlagMap(*this->BuildFileStream, " ");
clOptions.OutputPreprocessorDefinitions(*this->BuildFileStream, " ",
"\n", "CXX");
@@ -1577,21 +1584,6 @@ void cmVisualStudio10TargetGenerator::WriteClOptions(
this->WriteString("</ClCompile>\n", 2);
}
-void cmVisualStudio10TargetGenerator::
-OutputIncludes(std::vector<std::string> const & includes)
-{
- this->WriteString("<AdditionalIncludeDirectories>", 3);
- for(std::vector<std::string>::const_iterator i = includes.begin();
- i != includes.end(); ++i)
- {
- *this->BuildFileStream << cmVS10EscapeXML(*i) << ";";
- }
- this->WriteString("%(AdditionalIncludeDirectories)"
- "</AdditionalIncludeDirectories>\n", 0);
-}
-
-
-
//----------------------------------------------------------------------------
bool cmVisualStudio10TargetGenerator::ComputeRcOptions()
{
@@ -1643,9 +1635,11 @@ WriteRCOptions(std::string const& configName,
Options& clOptions = *(this->ClOptions[configName]);
clOptions.OutputPreprocessorDefinitions(*this->BuildFileStream, " ",
"\n", "RC");
- this->OutputIncludes(includes);
Options& rcOptions = *(this->RcOptions[configName]);
+ rcOptions.AppendFlag("AdditionalIncludeDirectories", includes);
+ rcOptions.AppendFlag("AdditionalIncludeDirectories",
+ "%(AdditionalIncludeDirectories)");
rcOptions.OutputFlagMap(*this->BuildFileStream, " ");
rcOptions.OutputAdditionalOptions(*this->BuildFileStream, " ", "");
@@ -1951,7 +1945,14 @@ WriteMidlOptions(std::string const& /*config*/,
// only). Perhaps there's something to be done to make this more automatic
// on the CMake side?
this->WriteString("<Midl>\n", 2);
- this->OutputIncludes(includes);
+ this->WriteString("<AdditionalIncludeDirectories>", 3);
+ for(std::vector<std::string>::const_iterator i = includes.begin();
+ i != includes.end(); ++i)
+ {
+ *this->BuildFileStream << cmVS10EscapeXML(*i) << ";";
+ }
+ this->WriteString("%(AdditionalIncludeDirectories)"
+ "</AdditionalIncludeDirectories>\n", 0);
this->WriteString("<OutputDirectory>$(IntDir)</OutputDirectory>\n", 3);
this->WriteString("<HeaderFileName>%(Filename).h</HeaderFileName>\n", 3);
this->WriteString(
diff --git a/Source/cmVisualStudio10TargetGenerator.h b/Source/cmVisualStudio10TargetGenerator.h
index 2bbdb8c..4e9bcd1 100644
--- a/Source/cmVisualStudio10TargetGenerator.h
+++ b/Source/cmVisualStudio10TargetGenerator.h
@@ -83,7 +83,6 @@ private:
void WriteLinkOptions(std::string const& config);
void WriteMidlOptions(std::string const& config,
std::vector<std::string> const & includes);
- void OutputIncludes(std::vector<std::string> const & includes);
void OutputLinkIncremental(std::string const& configName);
void WriteCustomRule(cmSourceFile const* source,
cmCustomCommand const & command);
diff --git a/Source/cmVisualStudioGeneratorOptions.cxx b/Source/cmVisualStudioGeneratorOptions.cxx
index b14fc45..745961f 100644
--- a/Source/cmVisualStudioGeneratorOptions.cxx
+++ b/Source/cmVisualStudioGeneratorOptions.cxx
@@ -324,10 +324,6 @@ cmVisualStudioGeneratorOptions
fout << sep << cmVisualStudio10GeneratorOptionsEscapeForXML(*i);
sep = ";";
}
- if (m->first == "AdditionalIncludeDirectories")
- {
- fout << sep << "%(AdditionalIncludeDirectories)";
- }
fout << "</" << m->first << ">\n";
}
}