summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2021-02-22 15:40:23 (GMT)
committerKitware Robot <kwrobot@kitware.com>2021-02-22 15:40:28 (GMT)
commit33d93089ef25d39e335ccc63c9e27c91a39e7bb1 (patch)
tree208b5b15d41415465ce95b80d0d436b2246c474b /Source
parent48797098fe15439d018c1ef423fd666fd68763a0 (diff)
parent9945b3b5655a8cefc0a0fb43bdb1948b6ab5bc32 (diff)
downloadCMake-33d93089ef25d39e335ccc63c9e27c91a39e7bb1.zip
CMake-33d93089ef25d39e335ccc63c9e27c91a39e7bb1.tar.gz
CMake-33d93089ef25d39e335ccc63c9e27c91a39e7bb1.tar.bz2
Merge topic 'vs-pch-one-lang' into release-3.20
9945b3b565 VS: Restore support for PCH in CXX but not C within once target d9fd32b3b3 cmVisualStudio10TargetGenerator: Refactor per-source PCH logic Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !5836
Diffstat (limited to 'Source')
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx18
1 files changed, 11 insertions, 7 deletions
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index a93a78a..6a90675 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -2413,18 +2413,20 @@ void cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags(
// 1. We have SKIP_PRECOMPILE_HEADERS == true
// 2. We are creating the pre-compiled header
// 3. We are a different language than the linker language AND pch is
- // enabled
- const std::string pchSource =
+ // enabled.
+ std::string const& linkLanguage =
+ this->GeneratorTarget->GetLinkerLanguage(config);
+ std::string const& pchSource =
this->GeneratorTarget->GetPchSource(config, lang);
const bool skipPCH =
pchSource.empty() || sf.GetPropertyAsBool("SKIP_PRECOMPILE_HEADERS");
const bool makePCH = (sf.GetFullPath() == pchSource);
- const bool useSharedPCH =
- !skipPCH && (lang == this->GeneratorTarget->GetLinkerLanguage(config));
- const bool useDifferentLangPCH =
- !skipPCH && (lang != this->GeneratorTarget->GetLinkerLanguage(config));
+ const bool useSharedPCH = !skipPCH && (lang == linkLanguage);
+ const bool useDifferentLangPCH = !skipPCH && (lang != linkLanguage);
+ const bool useNoPCH = skipPCH && (lang != linkLanguage) &&
+ !this->GeneratorTarget->GetPchHeader(config, linkLanguage).empty();
const bool needsPCHFlags =
- (makePCH || useSharedPCH || useDifferentLangPCH);
+ (makePCH || useSharedPCH || useDifferentLangPCH || useNoPCH);
// if we have flags or defines for this config then
// use them
@@ -2471,6 +2473,8 @@ void cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags(
if (makePCH) {
pchOptions =
this->GeneratorTarget->GetPchCreateCompileOptions(config, lang);
+ } else if (useNoPCH) {
+ clOptions.AddFlag("PrecompiledHeader", "NotUsing");
} else if (useSharedPCH) {
std::string pchHeader =
this->GeneratorTarget->GetPchHeader(config, lang);