From 029ddc341055b6eeee0c90ed843cf4b56e10a0e9 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Tue, 26 Dec 2023 11:43:03 -0500 Subject: cmVisualStudio10TargetGenerator: always specify scanning Set that sources should not be scanned on a target-wide basis and then enable on a per-TU basis as needed. Fixes: #25519 --- Source/cmVisualStudio10TargetGenerator.cxx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index e0be04d..708cbaf 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -2827,7 +2827,7 @@ void cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags( // use them if (!flags.empty() || !options.empty() || !configDefines.empty() || !includes.empty() || compileAsPerConfig || noWinRT || - !options.empty() || needsPCHFlags) { + !options.empty() || needsPCHFlags || shouldScanForModules) { cmGlobalVisualStudio10Generator* gg = this->GlobalGenerator; cmIDEFlagTable const* flagtable = nullptr; const std::string& srclang = source->GetLanguage(); @@ -2857,8 +2857,6 @@ void cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags( } if (shouldScanForModules) { clOptions.AddFlag("ScanSourceForModuleDependencies", "true"); - } else { - clOptions.AddFlag("ScanSourceForModuleDependencies", "false"); } if (noWinRT) { clOptions.AddFlag("CompileAsWinRT", "false"); @@ -3564,6 +3562,9 @@ void cmVisualStudio10TargetGenerator::WriteClOptions( e2.Element("AdditionalUsingDirectories", dirs); } } + + // Disable C++ source scanning by default. + e2.Element("ScanSourceForModuleDependencies", "false"); } bool cmVisualStudio10TargetGenerator::ComputeRcOptions() -- cgit v0.12