Fixes for DWrite header checks
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7f36b73..2236283 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -80,6 +80,7 @@
 ## Functions and headers
 include (CheckFunctionExists)
 include (CheckIncludeFile)
+include (CheckIncludeFiles)
 macro (check_funcs) # Similar to AC_CHECK_FUNCS of autotools
   foreach (func_name ${ARGN})
     string(TOUPPER ${func_name} definition_to_add)
@@ -308,10 +309,14 @@
 endif ()
 
 if (WIN32 AND HB_HAVE_DIRECTWRITE)
-  check_include_file_cxx(dwrite_1.h, HAVE_DWRITE_1_H)
-  if (NOT ${HAVE_DWRITE_1_H})
+  if (CMAKE_VERSION VERSION_GREATER 3.12)
+    check_include_files("windows.h;dwrite_1.h" HAVE_DWRITE_1_H LANGUAGE CXX)
+  else ()
+    check_include_files("windows.h;dwrite_1.h" HAVE_DWRITE_1_H)
+  endif ()
+  if (NOT HAVE_DWRITE_1_H)
     message(FATAL_ERROR "DirectWrite was enabled explicitly, but required header is missing")
-  endif()
+  endif ()
   add_definitions(-DHAVE_DIRECTWRITE)
   list(APPEND project_headers ${PROJECT_SOURCE_DIR}/src/hb-directwrite.h)
 endif ()
diff --git a/configure.ac b/configure.ac
index d763dc9..8873907 100644
--- a/configure.ac
+++ b/configure.ac
@@ -366,7 +366,7 @@
 have_directwrite=false
 AC_LANG_PUSH([C++])
 if test "x$with_directwrite" = "xyes" -o "x$with_directwrite" = "xauto"; then
-	AC_CHECK_HEADERS(dwrite.h, have_directwrite=true)
+	AC_CHECK_HEADERS(dwrite_1.h, have_directwrite=true)
 fi
 AC_LANG_POP([C++])
 if test "x$with_directwrite" = "xyes" -a "x$have_directwrite" != "xtrue"; then