--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -170,6 +170,9 @@
 endif()
 
 if (WIN32)
+  if(MINGW)
+    target_link_libraries(OIS "-ldinput8" "-ldxguid" "-lxinput")
+  elseif(MSVC)
     if (CMAKE_CL_64)
         set(DIRECTX_ARCH x64)
     else()
@@ -183,6 +186,7 @@
     else()
         target_link_libraries(OIS "${DXSDK_DIR}/Lib/${DIRECTX_ARCH}/dinput8.lib" "${DXSDK_DIR}/Lib/${DIRECTX_ARCH}/dxguid.lib")
     endif()
+  endif()
 endif()
 
 if(UNIX)
@@ -255,7 +259,7 @@
   install(FILES $<TARGET_PDB_FILE:OIS> DESTINATION bin OPTIONAL)
 endif(MSVC)
 
-if(UNIX)
+if(UNIX OR MINGW)
     configure_file(${CMAKE_CURRENT_SOURCE_DIR}/OIS.pc.in ${CMAKE_BINARY_DIR}/OIS.pc @ONLY)
     install(FILES ${CMAKE_BINARY_DIR}/OIS.pc DESTINATION ${OIS_LIB_DIRECTORY}/pkgconfig)
 endif()
