diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index a15cff54e3490b73ee4506ae942ba908dc87312e..28c2a1d0300b10f3e8e7325a3a8e130864f7b8ad 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -16,6 +16,8 @@ SET(xtpcpp_RCCS xtpcpp.qrc)
 FIND_PACKAGE( Qt5 COMPONENTS Core Gui Svg Xml PrintSupport REQUIRED )
 QT5_ADD_RESOURCES(xtpcpp_RCC_SRCS ${xtpcpp_RCCS})
 
+FIND_PACKAGE( ZLIB REQUIRED )
+
 if (QCustomPlot_FOUND)
 else (QCustomPlot_FOUND)
     FIND_PACKAGE( QCustomPlot REQUIRED )
@@ -241,16 +243,21 @@ target_compile_definitions(xtpcpp PUBLIC ${QT_DEFINITIONS})
     #COMPILE_DEFINITIONS "${QT_DEFINITIONS}"
     #INCLUDE_DIRECTORIES "${QT_INCLUDE_DIR} ${QT_QTCORE_INCLUDE_DIR}"
     )
-TARGET_LINK_LIBRARIES(xtpcpp ${PAPPSOMSPP_QT5_LIBRARY} ${PAPPSOMSPP_WIDGET_QT5_LIBRARY} ${Pwiz_LIBRARY} ${ODSSTREAM_QT5_LIBRARY} ${QCustomPlot_LIBRARIES}
-${Boost_chrono_LIBRARY}
-${Boost_filesystem_LIBRARY}
-${Boost_iostreams_LIBRARY}
-${Boost_program_options_LIBRARY}
-${Boost_serialization_LIBRARY}
-${Boost_system_LIBRARY}
-${Boost_thread_LIBRARY}
-
-Qt5::Gui Qt5::Xml Qt5::Svg Qt5::PrintSupport)
+if (MINGW)
+    TARGET_LINK_LIBRARIES(xtpcpp ${PAPPSOMSPP_QT5_LIBRARY} ${PAPPSOMSPP_WIDGET_QT5_LIBRARY} ${Pwiz_LIBRARY} ${ODSSTREAM_QT5_LIBRARY} ${QCustomPlot_LIBRARIES}
+    ${Boost_chrono_LIBRARY}
+    ${Boost_filesystem_LIBRARY}
+    ${Boost_iostreams_LIBRARY}
+    ${Boost_program_options_LIBRARY}
+    ${Boost_serialization_LIBRARY}
+    ${Boost_system_LIBRARY}
+    ${Boost_thread_LIBRARY}
+    ${ZLIB_LIBRARIES}
+    Qt5::Gui Qt5::Xml Qt5::Svg Qt5::PrintSupport)
+else (MINGW)
+    TARGET_LINK_LIBRARIES(xtpcpp ${PAPPSOMSPP_QT5_LIBRARY} ${PAPPSOMSPP_WIDGET_QT5_LIBRARY} ${Pwiz_LIBRARY} ${ODSSTREAM_QT5_LIBRARY} ${QCustomPlot_LIBRARIES}
+    Qt5::Gui Qt5::Xml Qt5::Svg Qt5::PrintSupport)
+endif (MINGW)
 
 INSTALL(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/xtpcpp DESTINATION bin)