Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 15f16ec

Browse files
committed
Don't duplicate references and libraries in MSVC scripts
In order not to duplicate references and libraries in the Visual Studio project files produced by the MSVC build scripts, have them check if a particular reference or library already exists before adding the same one again. Reviewed-by: Álvaro Herrera, Andrew Dunstan, Dagfinn Ilmari Mannsåker Discussion: https://postgr.es/m/CAApHDvpo6g5csCTjc_0C7DMvgFPomVb0Rh-AcW5afd=Ya=LRuw@mail.gmail.com
1 parent 33d74c5 commit 15f16ec

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/tools/msvc/Project.pm

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,10 @@ sub AddReference
124124

125125
while (my $ref = shift)
126126
{
127-
push @{ $self->{references} }, $ref;
127+
if (! grep { $_ eq $ref} @{ $self->{references} })
128+
{
129+
push @{ $self->{references} }, $ref;
130+
}
128131
$self->AddLibrary(
129132
"__CFGNAME__/" . $ref->{name} . "/" . $ref->{name} . ".lib");
130133
}
@@ -141,7 +144,11 @@ sub AddLibrary
141144
$lib = '"' . $lib . """;
142145
}
143146

144-
push @{ $self->{libraries} }, $lib;
147+
if (! grep { $_ eq $lib} @{ $self->{libraries} })
148+
{
149+
push @{ $self->{libraries} }, $lib;
150+
}
151+
145152
if ($dbgsuffix)
146153
{
147154
push @{ $self->{suffixlib} }, $lib;

0 commit comments

Comments
 (0)