Only in libgd-2.2.3-new: .vscode
diff -ur libgd-2.2.3/CMakeLists.txt libgd-2.2.3-new/CMakeLists.txt
--- libgd-2.2.3/CMakeLists.txt	2016-07-21 10:32:27.000000000 +0200
+++ libgd-2.2.3-new/CMakeLists.txt	2016-09-24 10:02:06.156526100 +0200
@@ -203,6 +207,7 @@
 			ADD_DEFINITIONS("/D_CRT_SECURE_NO_DEPRECATE")
 		endif(NOT MINGW AND MSVC_VERSION GREATER 1399)
 		if (MINGW OR MSYS)
+			SET(GD_LIB gd)
 			ADD_DEFINITIONS("-mms-bitfields") # -m32
 		endif (MINGW OR MSYS)
 	else (WIN32)
@@ -278,6 +282,6 @@
 "^${PROJECT_SOURCE_DIR}/old/"
 "^${PROJECT_SOURCE_DIR}/bld/"
 )
-install(FILES ${top_level_DOCFILES} DESTINATION ${DOC_DIR})
+# install(FILES ${top_level_DOCFILES} DESTINATION ${DOC_DIR})
 INCLUDE(CPack)
 
diff -ur libgd-2.2.3/config/gdlib.pc.in libgd-2.2.3-new/config/gdlib.pc.in
--- libgd-2.2.3/config/gdlib.pc.in	2016-06-03 10:34:39.000000000 +0200
+++ libgd-2.2.3-new/config/gdlib.pc.in	2016-09-25 11:09:38.702045800 +0200
@@ -1,13 +1,13 @@
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-libdir=@libdir@
-includedir=@includedir@
+prefix=@CMAKE_INSTALL_PREFIX@
+exec_prefix=${prefix}
+libdir=${prefix}/lib
+includedir=${prefix}/include/
 
 Name: gd
 Description: GD graphics library
-Version: @VERSION@
-Requires:
-Requires.private: @PKG_REQUIRES_PRIVATES@
-Cflags: -I${includedir}
-Libs.private: @LIBS_PRIVATES@ @LIBICONV@
+Version: @GD_VERSION_STRING@
+Requires:
+Requires.private: @PKG_REQUIRES_PRIVATES@
+Cflags: -I${includedir}
+Libs.private: @PRIVLIBLIST@
 Libs: -L${libdir} -lgd
diff -ur libgd-2.2.4/src/CMakeLists.txt.orig libgd-2.2.4/src/CMakeLists.txt
--- libgd-2.2.4/src/CMakeLists.txt.orig	2017-01-18 06:01:19.000000000 -0500
+++ libgd-2.2.4/src/CMakeLists.txt	2017-01-23 13:39:47.661420900 -0500
@@ -105,14 +105,14 @@
 	add_library(gd_programs_lib STATIC ${GD_PROGRAMS_LIB_SRC_FILES})
 endif()
 
-if (WIN32 AND NOT MINGW AND NOT MSYS)
+if (WIN32)
   #	SET_TARGET_PROPERTIES(${GD_LIB} PROPERTIES LINK_FLAGS "/NODEFAULTLIB:msvcrt.lib")
 
   if (BUILD_STATIC_LIBS)
     SET_PROPERTY(TARGET ${GD_LIB_STATIC} APPEND PROPERTY COMPILE_DEFINITIONS NONDLL=1)
   endif()
 
-ENDIF(WIN32 AND NOT MINGW AND NOT MSYS)
+ENDIF(WIN32)
 
 if (MINGW OR MSYS)
 	ADD_DEFINITIONS("-mms-bitfields")
@@ -157,7 +157,7 @@
 endif()
 
 install(TARGETS ${GD_INSTALL_TARGETS}
-        RUNTIME DESTINATION bin
+        RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
         LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
         ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
 install(PROGRAMS bdftogd DESTINATION bin)
@@ -176,7 +179,7 @@
 	gdfontt.h
 	gdfx.h
 	gdpp.h
-	DESTINATION include)
+	DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
 
 CONFIGURE_FILE(../config/gdlib.pc.cmake gdlib.pc @ONLY)
 INSTALL(FILES "${CMAKE_CURRENT_BINARY_DIR}/gdlib.pc" DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
diff -ur libgd-2.2.3/src/webpng.c libgd-2.2.3-new/src/webpng.c
--- libgd-2.2.3/src/webpng.c	2016-06-03 10:34:39.000000000 +0200
+++ libgd-2.2.3-new/src/webpng.c	2016-09-24 09:49:11.582098800 +0200
@@ -18,6 +18,25 @@
 #include <unistd.h>
 #endif
 
+#if defined (_WIN32)
+int     opterr = 1,             /* if error message should be printed */
+  optind = 1,             /* index into parent argv vector */
+  optopt,                 /* character checked for validity */
+  optreset;               /* reset getopt */
+char    *optarg;                /* argument associated with option */
+
+#define BADCH   (int)'?'
+#define BADARG  (int)':'
+#define EMSG    ""
+
+/*
+* getopt --
+*      Parse argc/argv argument vector.
+*/
+int getopt(int nargc, char * const nargv[], const char *ostr);
+
+#endif // defined (_WIN32)
+
 #ifdef __clang__
 /* Workaround broken clang behavior: https://llvm.org/bugs/show_bug.cgi?id=20144 */
 #undef strcmp
@@ -295,3 +314,66 @@
 	/* All's well that ends well. */
 	return 0;
 }
+
+#if defined (_WIN32)
+/*
+* getopt --
+*      Parse argc/argv argument vector.
+*/
+int
+  getopt(int nargc, char * const nargv[], const char *ostr)
+{
+  static char *place = EMSG;              /* option letter processing */
+  const char *oli;                        /* option letter list index */
+
+  if (optreset || !*place) {              /* update scanning pointer */
+    optreset = 0;
+    if (optind >= nargc || *(place = nargv[optind]) != '-') {
+      place = EMSG;
+      return (-1);
+    }
+    if (place[1] && *++place == '-') {      /* found "--" */
+      ++optind;
+      place = EMSG;
+      return (-1);
+    }
+  }                                       /* option letter okay? */
+  if ((optopt = (int)*place++) == (int)':' ||
+    !(oli = strchr(ostr, optopt))) {
+      /*
+      * if the user didn't specify '-' as an option,
+      * assume it means -1.
+      */
+      if (optopt == (int)'-')
+        return (-1);
+      if (!*place)
+        ++optind;
+      if (opterr && *ostr != ':')
+        (void)printf("illegal option -- %c\n", optopt);
+      return (BADCH);
+  }
+  if (*++oli != ':') {                    /* don't need argument */
+    optarg = NULL;
+    if (!*place)
+      ++optind;
+  }
+  else {                                  /* need an argument */
+    if (*place)                     /* no white space */
+      optarg = place;
+    else if (nargc <= ++optind) {   /* no arg */
+      place = EMSG;
+      if (*ostr == ':')
+        return (BADARG);
+      if (opterr)
+        (void)printf("option requires an argument -- %c\n", optopt);
+      return (BADCH);
+    }
+    else                            /* white space */
+      optarg = nargv[optind];
+    place = EMSG;
+    ++optind;
+  }
+  return (optopt);                        /* dump back option letter */
+}
+#endif //defined (_WIN32)
+
--- libgd-2.2.5/src/gd.h.orig	2017-10-02 13:50:31.857516500 +0300
+++ libgd-2.2.5/src/gd.h	2017-10-02 14:03:15.317333300 +0300
@@ -46,34 +46,31 @@
 
 /* http://gcc.gnu.org/wiki/Visibility */
 #if defined(_WIN32) || defined(CYGWIN) || defined(_WIN32_WCE)
-# ifdef BGDWIN32
-#  ifdef NONDLL
-#   define BGD_EXPORT_DATA_PROT
-#  else
-#   ifdef __GNUC__
-#    define BGD_EXPORT_DATA_PROT __attribute__ ((__dllexport__))
-#   else
-#    define BGD_EXPORT_DATA_PROT __declspec(dllexport)
-#   endif
-#  endif
-# else
-#  ifdef __GNUC__
-#   define BGD_EXPORT_DATA_PROT __attribute__ ((__dllimport__))
-#  else
-#   define BGD_EXPORT_DATA_PROT __declspec(dllimport)
-#  endif
-# endif
-# define BGD_STDCALL __stdcall
-# define BGD_EXPORT_DATA_IMPL
+  #ifdef NONDLL // static build
+    #define BGD_EXPORT_DATA_PROT
+    #define BGD_STDCALL
+  #else
+    #ifdef BGDWIN32 // defined if we are building the GD DLL (instead of using it)
+      #define BGD_EXPORT_DATA_PROT __attribute__ ((dllexport))
+    #else
+      #define BGD_EXPORT_DATA_PROT __attribute__ ((dllimport))
+    #endif
+    #ifdef __MINGW32__
+      #define BGD_STDCALL
+    #else
+      #define BGD_STDCALL __stdcall
+    #endif
+  #endif
+  #define BGD_EXPORT_DATA_IMPL
 #else
-# if defined(__GNUC__) || defined(__clang__)
-#  define BGD_EXPORT_DATA_PROT __attribute__ ((__visibility__ ("default")))
-#  define BGD_EXPORT_DATA_IMPL __attribute__ ((__visibility__ ("hidden")))
-# else
-#  define BGD_EXPORT_DATA_PROT
-#  define BGD_EXPORT_DATA_IMPL
-# endif
-# define BGD_STDCALL
+  #if defined(__GNUC__) || defined(__clang__)
+    #define BGD_EXPORT_DATA_PROT __attribute__ ((visibility ("default")))
+    #define BGD_EXPORT_DATA_IMPL __attribute__ ((visibility ("hidden")))
+  #else
+    #define BGD_EXPORT_DATA_PROT
+    #define BGD_EXPORT_DATA_IMPL
+  #endif
+  #define BGD_STDCALL
 #endif
 
 #define BGD_DECLARE(rt) BGD_EXPORT_DATA_PROT rt BGD_STDCALL
