Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Rowley2021-07-28 22:41:31 +0000
committerDavid Rowley2021-07-28 22:41:31 +0000
commit15f16ec6511cf50374b09876e39c6939f2da0f08 (patch)
treedf2fca3e129bfd2ec8ffb431dd7414c14214c58e /src/tools/msvc/Project.pm
parent33d74c5d00e45248df66fa1bcd9222e0713ea5b1 (diff)
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
Diffstat (limited to 'src/tools/msvc/Project.pm')
-rw-r--r--src/tools/msvc/Project.pm11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/tools/msvc/Project.pm b/src/tools/msvc/Project.pm
index a6c3aa0d687..f1c93a3fa32 100644
--- a/src/tools/msvc/Project.pm
+++ b/src/tools/msvc/Project.pm
@@ -124,7 +124,10 @@ sub AddReference
while (my $ref = shift)
{
- push @{ $self->{references} }, $ref;
+ if (! grep { $_ eq $ref} @{ $self->{references} })
+ {
+ push @{ $self->{references} }, $ref;
+ }
$self->AddLibrary(
"__CFGNAME__/" . $ref->{name} . "/" . $ref->{name} . ".lib");
}
@@ -141,7 +144,11 @@ sub AddLibrary
$lib = '"' . $lib . """;
}
- push @{ $self->{libraries} }, $lib;
+ if (! grep { $_ eq $lib} @{ $self->{libraries} })
+ {
+ push @{ $self->{libraries} }, $lib;
+ }
+
if ($dbgsuffix)
{
push @{ $self->{suffixlib} }, $lib;