diff --git a/CMakeLists.txt b/CMakeLists.txt
index 97850f7..ae204e1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -369,6 +369,10 @@ if(CAIRO_FOUND)
   poppler_create_install_pkgconfig(poppler-cairo.pc lib/pkgconfig)
 endif(CAIRO_FOUND)
 
+if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/../poppler-data)
+  set(POPPLER_DATA_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../poppler-data)
+  include(${CMAKE_CURRENT_SOURCE_DIR}/../poppler-data/CMakeLists.txt)
+endif(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/../poppler-data)
 
 message("Building Poppler with support for:")
 show_end_message("splash output" ENABLE_SPLASH)
diff --git a/config.h.cmake b/config.h.cmake
index a496b3f..61f673a 100644
--- a/config.h.cmake
+++ b/config.h.cmake
@@ -138,6 +138,9 @@
 #define HAVE_BOOLEAN
 #endif
 
+#ifdef _MSC_VER
+#include <winsock2.h>
+#endif
 
 /* Number of bits in a file offset, on hosts where this is settable. */
 /* #undef _FILE_OFFSET_BITS */
diff --git a/goo/GooString.cc b/goo/GooString.cc
index 6817df5..15f29a1 100644
--- a/goo/GooString.cc
+++ b/goo/GooString.cc
@@ -23,6 +23,12 @@
 #include "gmem.h"
 #include "GooString.h"
 
+#ifdef _MSC_VER
+# undef ___QNAN
+# undef ___INFF
+# undef ___INFL
+#endif
+
 //------------------------------------------------------------------------
 
 union GooStringFormatArg {
diff --git a/poppler-config.h.cmake b/poppler-config.h.cmake
index 3a1547d..31522f6 100644
--- a/poppler-config.h.cmake
+++ b/poppler-config.h.cmake
@@ -136,7 +136,7 @@
 //------------------------------------------------------------------------
 
 #ifdef CDECL
-#cmakedefine CDECL 1
+#undef CDECL
 #endif
 
 #if defined(_MSC_VER) || defined(__BORLANDC__)
