mirror of
https://github.com/Kitware/CMake.git
synced 2026-04-24 07:08:38 -05:00
cmLocalGenerator: ignore scanned sources for unity builds
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user