Skip to content

Commit 4a2d758

Browse files
committed
Handle duplicate conditional files.
1 parent 4c9e531 commit 4a2d758

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed

source/projectGenerator_files.cpp

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -191,18 +191,23 @@ bool ProjectGenerator::createReplaceFiles(
191191
hasOther = true;
192192
}
193193
}
194+
// Check if already a conditional file
195+
auto j = conditionalIncludes.find(replaceInclude);
196+
if (j != conditionalIncludes.end()) {
197+
if (hasOther) {
198+
conditionalIncludes.erase(j);
199+
} else if (j->second.isStatic != isStatic || j->second.isShared != isShared || j->second.is32 != is32 ||
200+
j->second.is64 != is64) {
201+
outputError("Duplicate conditional files found with different conditions (" + replaceInclude + ")");
202+
// TODO: Remove and make wrapped
203+
return false;
204+
} else {
205+
// skip this item
206+
continue;
207+
}
208+
}
194209
// Check for config requirement that can be handled by VS (i.e. static/shared|32/64bit)
195210
if ((isShared || isStatic || is32 || is64) && !hasOther) {
196-
// Check if already a conditional file
197-
auto j = conditionalIncludes.find(replaceInclude);
198-
if (j != conditionalIncludes.end()) {
199-
if (j->second.isStatic != isStatic || j->second.isShared != isShared || j->second.is32 != is32 ||
200-
j->second.is64 != is64) {
201-
outputError("Duplicate conditional files found with different conditions (" + replaceInclude + ")");
202-
// TODO: Remove and make wrapped
203-
return false;
204-
}
205-
}
206211
conditionalIncludes.emplace(replaceInclude, ConfigConds{isStatic, isShared, is32, is64});
207212
continue;
208213
}

0 commit comments

Comments
 (0)