diff --git a/CMakeLists.txt b/CMakeLists.txt
index b33b2c7..33b522e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -63,6 +63,9 @@ if(ENABLE_ABIWORD)
   find_package(LibXml2)
   set(ENABLE_ABIWORD ${LIBXML2_FOUND})
 endif(ENABLE_ABIWORD)
+if(NOT BUILD_SHARED_LIBS AND NOT MSVC)
+set(BUILD_SHARED_LIBS SHARED)
+endif(NOT BUILD_SHARED_LIBS AND NOT MSVC)
 
 add_definitions(-DHAVE_CONFIG_H=1 ${FONTCONFIG_DEFINITIONS})
 include_directories(
@@ -75,7 +78,6 @@ include_directories(
   ${FREETYPE_INCLUDE_DIR}
 )
 set(HAVE_FREETYPE_H ON)
-
 if(ENABLE_ZLIB)
   include_directories(${ZLIB_INCLUDE_DIR})
 endif(ENABLE_ZLIB)
@@ -212,12 +214,16 @@ if(ENABLE_ABIWORD)
   )
   set(poppler_LIBS ${poppler_LIBS} ${LIBXML2_LIBRARIES})
 endif(ENABLE_ABIWORD)
+if(MSVC)
+  set(poppler_SRCS ${poppler_SRCS} poppler/GlobalParamsWin.cc)
+endif(MSVC)
 if(WIN32)
   # gdi32 is needed under win32
   set(poppler_LIBS ${poppler_LIBS} gdi32)
 endif(WIN32)
 
-add_library(poppler SHARED ${poppler_SRCS})
+add_library(poppler ${poppler_SRCS})
+
 set_target_properties(poppler PROPERTIES VERSION 2.0.0 SOVERSION 2)
 target_link_libraries(poppler ${poppler_LIBS})
 install(TARGETS poppler RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib)
diff --git a/config.h.cmake b/config.h.cmake
index a496b3f..56fd0f3 100644
--- a/config.h.cmake
+++ b/config.h.cmake
@@ -138,6 +138,10 @@
 #define HAVE_BOOLEAN
 #endif
 
+ /* MS has defined snprintf as deprecated */
+#ifdef _MSC_VER
+#define snprintf _snprintf
+#endif
 
 /* Number of bits in a file offset, on hosts where this is settable. */
 /* #undef _FILE_OFFSET_BITS */
diff --git a/glib/CMakeLists.txt b/glib/CMakeLists.txt
index ceb1a7f..2fc841c 100644
--- a/glib/CMakeLists.txt
+++ b/glib/CMakeLists.txt
@@ -83,7 +83,7 @@ if (CAIRO_FOUND)
     ${CMAKE_SOURCE_DIR}/poppler/CairoOutputDev.cc
   )
 endif (CAIRO_FOUND)
-add_library(poppler-glib SHARED ${poppler_glib_SRCS})
+add_library(poppler-glib ${poppler_glib_SRCS})
 set_target_properties(poppler-glib PROPERTIES VERSION 2.0.0 SOVERSION 2)
 target_link_libraries(poppler-glib poppler ${GLIB2_LIBRARIES})
 if (CAIRO_FOUND)
diff --git a/poppler/Function.cc b/poppler/Function.cc
index dfaf04c..24673bc 100644
--- a/poppler/Function.cc
+++ b/poppler/Function.cc
@@ -23,6 +23,11 @@
 #include "Error.h"
 #include "Function.h"
 
+// fix for MSVC:
+#ifndef M_PI
+#define M_PI 3.14159265358979323846
+#endif
+
 //------------------------------------------------------------------------
 // Function
 //------------------------------------------------------------------------
diff --git a/qt4/src/CMakeLists.txt b/qt4/src/CMakeLists.txt
index 29ef8e5..9a549d5 100644
--- a/qt4/src/CMakeLists.txt
+++ b/qt4/src/CMakeLists.txt
@@ -29,7 +29,7 @@ if (ENABLE_SPLASH)
     ${CMAKE_SOURCE_DIR}/poppler/ArthurOutputDev.cc
   )
 endif (ENABLE_SPLASH)
-add_library(poppler-qt4 SHARED ${poppler_qt4_SRCS})
+add_library(poppler-qt4 ${poppler_qt4_SRCS})
 set_target_properties(poppler-qt4 PROPERTIES VERSION 2.0.0 SOVERSION 2)
 target_link_libraries(poppler-qt4 poppler ${QT4_QTCORE_LIBRARY} ${QT4_QTGUI_LIBRARY} ${QT4_QTXML_LIBRARY})
 install(TARGETS poppler-qt4 RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib)
diff --git a/utils/CMakeLists.txt b/utils/CMakeLists.txt
index 8f8b418..a78fdfe 100644
--- a/utils/CMakeLists.txt
+++ b/utils/CMakeLists.txt
@@ -9,6 +9,9 @@ if (FONTCONFIG_FOUND)
   set(common_libs ${common_libs} ${FONTCONFIG_LIBRARIES})
 endif (FONTCONFIG_FOUND)
 
+if (MSVC)
+set(common_libs ${common_libs} ${JPEG_LIBRARIES} ${LIBXML2_LIBRARIES} ${FREETYPE_LIBRARIES})
+endif (MSVC)
 if (ENABLE_SPLASH)
   # pdftoppm
   set(pdftoppm_SOURCES ${common_srcs}
diff --git a/utils/pdftoabw.cc b/utils/pdftoabw.cc
index 646f996..1de338d 100644
--- a/utils/pdftoabw.cc
+++ b/utils/pdftoabw.cc
@@ -12,7 +12,9 @@
 #include <stdlib.h>
 #include <stddef.h>
 #include <string.h>
+#ifdef HAVE_DIRENT_H
 #include <dirent.h>
+#endif
 #include <time.h>
 #include "parseargs.h"
 #include "goo/GooString.h"
diff --git a/utils/pdftohtml.cc b/utils/pdftohtml.cc
index 30a2818..1ebd7af 100644
--- a/utils/pdftohtml.cc
+++ b/utils/pdftohtml.cc
@@ -12,7 +12,9 @@
 #include <stdlib.h>
 #include <stddef.h>
 #include <string.h>
+#ifdef HAVE_DIRENT_H
 #include <dirent.h>
+#endif
 #include <time.h>
 #include "parseargs.h"
 #include "goo/GooString.h"
