diff options
author | Brad King <brad.king@kitware.com> | 2021-02-19 16:25:26 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2021-02-19 16:25:29 (GMT) |
commit | 9945b3b5655a8cefc0a0fb43bdb1948b6ab5bc32 (patch) | |
tree | 4ac87f23608c47d9036ef850cd8023e4d05747ea /Source | |
parent | d9fd32b3b347327adb146284b543ec8e97cae6bd (diff) | |
download | CMake-9945b3b5655a8cefc0a0fb43bdb1948b6ab5bc32.zip CMake-9945b3b5655a8cefc0a0fb43bdb1948b6ab5bc32.tar.gz CMake-9945b3b5655a8cefc0a0fb43bdb1948b6ab5bc32.tar.bz2 |
VS: Restore support for PCH in CXX but not C within once target
Fix logic from commit 9df1f33c9a (VisualStudio: move PCH rules to
projects when possible., 2020-10-15, v3.20.0-rc1~638^2) to explicitly
disable PCH on sources that should not use the target-wide PCH rules.
Fixes: #21827
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmVisualStudio10TargetGenerator.cxx | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 50a456d..6a90675 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -2423,8 +2423,10 @@ void cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags( const bool makePCH = (sf.GetFullPath() == pchSource); 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); |