Commit 5c2fd97d authored by Daniel Pfeifer's avatar Daniel Pfeifer
Browse files

PCH: implementation for Visual Studio 10.0

parent 56ee545f
Pipeline #62471 passed with stage
...@@ -1897,6 +1897,18 @@ void cmVisualStudio10TargetGenerator::WriteAllSources() ...@@ -1897,6 +1897,18 @@ void cmVisualStudio10TargetGenerator::WriteAllSources()
this->WriteMissingFiles(); this->WriteMissingFiles();
} }
// Precompile Headers
const std::string& linkLanguage = this->GeneratorTarget->GetLinkerLanguage();
std::string pchSource =
this->GeneratorTarget->GetPchSource("", linkLanguage);
if (!pchSource.empty()) {
this->ConvertToWindowsSlash(pchSource);
this->WriteString("<ClCompile Include=\"", 2);
(*this->BuildFileStream) << cmVS10EscapeXML(pchSource) << "\">\n";
this->WriteString("<PrecompiledHeader>Create</PrecompiledHeader>\n", 3);
this->WriteString("</ClCompile>\n", 2);
}
this->WriteString("</ItemGroup>\n", 1); this->WriteString("</ItemGroup>\n", 1);
} }
...@@ -2271,13 +2283,24 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions( ...@@ -2271,13 +2283,24 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions(
// Check IPO related warning/error. // Check IPO related warning/error.
this->GeneratorTarget->IsIPOEnabled(linkLanguage, configName); this->GeneratorTarget->IsIPOEnabled(linkLanguage, configName);
// Precompile Headers
std::string pchHeader =
this->GeneratorTarget->GetPchHeader(configName, linkLanguage);
if (!pchHeader.empty()) {
this->ConvertToWindowsSlash(pchHeader);
clOptions.AddFlag("PrecompiledHeader", "Use");
clOptions.AddFlag("PrecompiledHeaderFile", pchHeader.c_str());
clOptions.AddFlag("ForcedIncludeFiles", pchHeader.c_str());
} else if (this->MSTools && vcxproj == this->ProjectType) {
clOptions.AddFlag("PrecompiledHeader", "NotUsing");
}
// Get preprocessor definitions for this directory. // Get preprocessor definitions for this directory.
std::string defineFlags = std::string defineFlags =
this->GeneratorTarget->Target->GetMakefile()->GetDefineFlags(); this->GeneratorTarget->Target->GetMakefile()->GetDefineFlags();
if (this->MSTools) { if (this->MSTools) {
if (vcxproj == this->ProjectType) { if (vcxproj == this->ProjectType) {
clOptions.FixExceptionHandlingDefault(); clOptions.FixExceptionHandlingDefault();
clOptions.AddFlag("PrecompiledHeader", "NotUsing");
std::string asmLocation = configName + "/"; std::string asmLocation = configName + "/";
clOptions.AddFlag("AssemblerListingLocation", asmLocation.c_str()); clOptions.AddFlag("AssemblerListingLocation", asmLocation.c_str());
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment