diff --git a/CMakeLists.txt b/CMakeLists.txt
index 89a73a4..fe9bc65 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -321,6 +321,10 @@ else ()
   list(APPEND BASE_SRCS src/base/ftdebug.c)
 endif ()
 
+if(MSVC)
+  add_definitions(-D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS)
+endif()
+
 if (BUILD_FRAMEWORK)
   list(APPEND BASE_SRCS builds/mac/freetype-Info.plist)
 endif ()
diff --git a/include/freetype/freetype.h b/include/freetype/freetype.h
index 9664404..f56335a 100644
--- a/include/freetype/freetype.h
+++ b/include/freetype/freetype.h
@@ -1066,6 +1066,11 @@ FT_BEGIN_HEADER
   /*    Especially for TrueType fonts see also the documentation for       */
   /*    @FT_Size_Metrics.                                                  */
   /*                                                                       */
+
+#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY != WINAPI_FAMILY_DESKTOP_APP)
+#define generic GenericFromFreeTypeLibrary
+#endif
+
   typedef struct  FT_FaceRec_
   {
     FT_Long           num_faces;
@@ -1942,6 +1947,9 @@ FT_BEGIN_HEADER
 
   } FT_GlyphSlotRec;
 
+#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY != WINAPI_FAMILY_DESKTOP_APP)
+#undef generic
+#endif
 
   /*************************************************************************/
   /*************************************************************************/
diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c
index 8d07e35..ce6fffd 100644
--- a/src/base/ftobjs.c
+++ b/src/base/ftobjs.c
@@ -491,6 +491,10 @@
     return error;
   }
 
+#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY != WINAPI_FAMILY_DESKTOP_APP)
+#define generic GenericFromFreeTypeLibrary
+#endif
+
 
   static void
   ft_glyphslot_clear( FT_GlyphSlot  slot )
@@ -1151,6 +1155,10 @@
     FT_FREE( face );
   }
 
+#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY != WINAPI_FAMILY_DESKTOP_APP)
+#undef generic
+#endif
+
 
   static void
   Destroy_Driver( FT_Driver  driver )
