--- a/addon/doxysearch/CMakeLists.txt
+++ b/addon/doxysearch/CMakeLists.txt
@@ -1,7 +1,7 @@
 find_package(xapian REQUIRED)
 find_package(ZLIB REQUIRED)
 
-if (WIN32)
+if (WIN32 AND NOT(MINGW))
   set(WIN_EXTRA_LIBS uuid.lib rpcrt4.lib ws2_32.lib)
 endif()
 
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -277,7 +277,7 @@
 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_MINSIZEREL ${EXECUTABLE_OUTPUT_PATH})
 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO ${EXECUTABLE_OUTPUT_PATH})
 
-if (win_static)
+if (win_static AND MSVC)
     set(CompilerFlags
         CMAKE_CXX_FLAGS
         CMAKE_CXX_FLAGS_DEBUG
