Skip to content

Commit 1577b30

Browse files
committed
fixup! msvc: support building Git using MS Visual C++
Recent vcpkg versions renamed `libcurl.lib` to `libcurl_imp.lib`. Therefore, we need to look closely whether one or the other is present, and use that one instead. This fixes #2195 Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 224674a commit 1577b30

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

compat/vcbuild/scripts/clink.pl

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,20 @@
4949
} elsif ("$arg" eq "-lssl") {
5050
push(@args, "ssleay32.lib");
5151
} elsif ("$arg" eq "-lcurl") {
52-
push(@args, "libcurl.lib");
52+
my $lib = "";
53+
# Newer vcpkg definitions call this libcurl_imp.lib; Do we
54+
# need to use that instead?
55+
foreach my $flag (@lflags) {
56+
if ($flag =~ /^-LIBPATH:(.*)/) {
57+
foreach my $l ("libcurl_imp.lib", "libcurl.lib") {
58+
if (-f "$1/$l") {
59+
$lib = $l;
60+
last;
61+
}
62+
}
63+
}
64+
}
65+
push(@args, $lib);
5366
} elsif ("$arg" eq "-lexpat") {
5467
push(@args, "expat.lib");
5568
} elsif ("$arg" =~ /^-L/ && "$arg" ne "-LTCG") {

0 commit comments

Comments
 (0)