Add -D_WIN32_WINNT=0x0601 flag to target Windows 7

Also document that Visual Studio 2015 (14.0) is required for Visual
Studio build.

BUG=aomedia:2242

Change-Id: I043b327cd47f1a77ad07886c5501ef65b3350934
diff --git a/README.md b/README.md
index cab3f99..6b58d35 100644
--- a/README.md
+++ b/README.md
@@ -210,15 +210,18 @@
 
 ### Microsoft Visual Studio builds
 
-Building the AV1 codec library in Microsoft Visual Studio is supported. The
-following example demonstrates generating projects and a solution for the
-Microsoft IDE:
+Building the AV1 codec library in Microsoft Visual Studio is supported. Visual
+Studio 2015 (14.0) or later is required. The following example demonstrates
+generating projects and a solution for the Microsoft IDE:
 
 ~~~
     # This does not require a bash shell; command.exe is fine.
     $ cmake path/to/aom -G "Visual Studio 15 2017"
 ~~~
 
+NOTE: The build system targets Windows 7 or later by compiling files with
+`-D_WIN32_WINNT=0x0601`.
+
 ### Xcode builds
 
 Building the AV1 codec library in Xcode is supported. The following example
diff --git a/build/cmake/aom_configure.cmake b/build/cmake/aom_configure.cmake
index 8b2a2af..41d8baf 100644
--- a/build/cmake/aom_configure.cmake
+++ b/build/cmake/aom_configure.cmake
@@ -188,6 +188,12 @@
   set(CONFIG_OS_SUPPORT 1)
 endif()
 
+# The default _WIN32_WINNT value in MinGW is 0x0502 (Windows XP with SP2). Set
+# it to 0x0601 (Windows 7).
+if("${AOM_TARGET_SYSTEM}" STREQUAL "Windows")
+  add_compiler_flag_if_supported("-D_WIN32_WINNT=0x0601")
+endif()
+
 #
 # Fix CONFIG_* dependencies. This must be done before including cpu.cmake to
 # ensure RTCD_CONFIG_* are properly set.