summaryrefslogtreecommitdiffstats
path: root/Source/cmVisualStudio10TargetGenerator.cxx
diff options
context:
space:
mode:
authorCristian Adam <cristian.adam@gmail.com>2019-07-13 10:07:30 (GMT)
committerBrad King <brad.king@kitware.com>2019-08-28 15:47:51 (GMT)
commit519606704eac6df1314ec6691a1b77d2131a6dbc (patch)
treee385553188a284cef18bfeae07c3ee5827d5e434 /Source/cmVisualStudio10TargetGenerator.cxx
parent28be170fbc97a29be6383fb4afe5f62c6983fb2c (diff)
downloadCMake-519606704eac6df1314ec6691a1b77d2131a6dbc.zip
CMake-519606704eac6df1314ec6691a1b77d2131a6dbc.tar.gz
CMake-519606704eac6df1314ec6691a1b77d2131a6dbc.tar.bz2
Precompile headers: Add support for Visual Studio generators
Tested with Visual C++ 2017 on Windows. Co-Author: Daniel Pfeifer <daniel@pfeifer-mail.de>
Diffstat (limited to 'Source/cmVisualStudio10TargetGenerator.cxx')
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx13
1 files changed, 12 insertions, 1 deletions
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index 13f6295..749d234 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -249,6 +249,8 @@ cmVisualStudio10TargetGenerator::cmVisualStudio10TargetGenerator(
this->LocalGenerator->GetTargetDirectory(this->GeneratorTarget);
this->InSourceBuild = (this->Makefile->GetCurrentSourceDirectory() ==
this->Makefile->GetCurrentBinaryDirectory());
+
+ this->LocalGenerator->AddPchDependencies(target, "");
}
cmVisualStudio10TargetGenerator::~cmVisualStudio10TargetGenerator()
@@ -2145,6 +2147,9 @@ void cmVisualStudio10TargetGenerator::WriteAllSources(Elem& e0)
if (si.Kind == cmGeneratorTarget::SourceKindObjectSource) {
this->OutputSourceSpecificFlags(e2, si.Source);
}
+ if (si.Source->GetPropertyAsBool("SKIP_PRECOMPILE_HEADERS")) {
+ e2.Element("PrecompiledHeader", "NotUsing");
+ }
if (!exclude_configs.empty()) {
this->WriteExcludeFromBuild(e2, exclude_configs);
}
@@ -2626,6 +2631,13 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions(
this->IPOEnabledConfigurations.insert(configName);
}
+ // Precompile Headers
+ std::string pchHeader =
+ this->GeneratorTarget->GetPchHeader(configName, linkLanguage);
+ if (this->MSTools && vcxproj == this->ProjectType && pchHeader.empty()) {
+ clOptions.AddFlag("PrecompiledHeader", "NotUsing");
+ }
+
// Get preprocessor definitions for this directory.
std::string defineFlags = this->Makefile->GetDefineFlags();
if (this->MSTools) {
@@ -2641,7 +2653,6 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions(
// replace this setting with "true" below.
clOptions.AddFlag("UseFullPaths", "false");
}
- clOptions.AddFlag("PrecompiledHeader", "NotUsing");
clOptions.AddFlag("AssemblerListingLocation", "$(IntDir)");
}
}