diff options
author | Brad King <brad.king@kitware.com> | 2023-05-10 19:48:27 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2023-05-17 15:59:24 (GMT) |
commit | 406a103318ee58774ae7afd25d6746a5629f956a (patch) | |
tree | c3e0f968aa86a9274babd189662cb58ce3334c06 /Source/cmVisualStudio10TargetGenerator.cxx | |
parent | d9641980d2a223e0a6fe42ff23499e55f49fd6d5 (diff) | |
download | CMake-406a103318ee58774ae7afd25d6746a5629f956a.zip CMake-406a103318ee58774ae7afd25d6746a5629f956a.tar.gz CMake-406a103318ee58774ae7afd25d6746a5629f956a.tar.bz2 |
VS: Add support for C++ module internal partitions in VS 17.6 and newer
VS 17.6 now implements `ScanSourceforModuleDependencies` using the same
`cl /scanDependencies` scanner that our Ninja generator uses. It can
distinguish module internal partitions from module interface units based
on their content. Switch from `CompileAsCppModule` to `CompileAsCpp`
for `CXX_MODULES` sources so that MSBuild can scan and classify them.
Diffstat (limited to 'Source/cmVisualStudio10TargetGenerator.cxx')
-rw-r--r-- | Source/cmVisualStudio10TargetGenerator.cxx | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 7360bf5..6d62aff 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -2802,7 +2802,14 @@ void cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags( fs->GetType() == "CXX_MODULE_HEADER_UNITS"_s)) { if (lang == "CXX"_s) { if (fs->GetType() == "CXX_MODULES"_s) { - compileAsPerConfig = "CompileAsCppModule"; + if (shouldScanForModules && + this->GlobalGenerator->IsScanDependenciesSupported()) { + // ScanSourceforModuleDependencies uses 'cl /scanDependencies' and + // can distinguish module interface units and internal partitions. + compileAsPerConfig = "CompileAsCpp"; + } else { + compileAsPerConfig = "CompileAsCppModule"; + } } else { compileAsPerConfig = "CompileAsHeaderUnit"; } |