diff options
author | Ben Boeckel <ben.boeckel@kitware.com> | 2024-01-01 16:04:29 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2024-01-05 19:21:27 (GMT) |
commit | 63bbb3768d3cf87459b6b66effa8726f38cc745a (patch) | |
tree | 55bcf85e8ae41bedf013e2211c64c3f03544e653 /Source/cmLocalGenerator.cxx | |
parent | 76b5383123daa4249c9cfffdc93727713dfad29f (diff) | |
download | CMake-63bbb3768d3cf87459b6b66effa8726f38cc745a.zip CMake-63bbb3768d3cf87459b6b66effa8726f38cc745a.tar.gz CMake-63bbb3768d3cf87459b6b66effa8726f38cc745a.tar.bz2 |
cmLocalGenerator: ignore scanned sources for unity builds
Diffstat (limited to 'Source/cmLocalGenerator.cxx')
-rw-r--r-- | Source/cmLocalGenerator.cxx | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 168cd41..7337ea2 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -3134,6 +3134,15 @@ void cmLocalGenerator::AddUnityBuild(cmGeneratorTarget* target) std::vector<cmSourceFile*> sources; target->GetSourceFiles(sources, configs[ci]); for (cmSourceFile* sf : sources) { + // Files which need C++ scanning cannot participate in unity builds as + // there is a single place in TUs that may perform module-dependency bits + // and a unity source cannot `#include` them in-order and represent a + // valid TU. + if (sf->GetLanguage() == "CXX"_s && + target->NeedDyndepForSource("CXX", configs[ci], sf)) { + continue; + } + auto mi = index.find(sf); if (mi == index.end()) { unitySources.emplace_back(sf); |