mingw: change library names to include the soversion

Bug #103157
diff --git a/CMakeLists.txt b/CMakeLists.txt
index df70c15..3b0b912 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -545,6 +545,10 @@
 add_library(poppler ${poppler_SRCS})
 endif()
 set_target_properties(poppler PROPERTIES VERSION 71.0.0 SOVERSION 71)
+if(MINGW)
+    get_target_property(POPPLER_SOVERSION poppler SOVERSION)
+    set_target_properties(poppler PROPERTIES SUFFIX "-${POPPLER_SOVERSION}${CMAKE_SHARED_LIBRARY_SUFFIX}")
+endif()
 target_link_libraries(poppler LINK_PRIVATE ${poppler_LIBS})
 if(CMAKE_USE_PTHREADS_INIT)
    target_link_libraries(poppler LINK_PRIVATE Threads::Threads)
diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt
index 1cb26da..1fb20bb 100644
--- a/cpp/CMakeLists.txt
+++ b/cpp/CMakeLists.txt
@@ -24,6 +24,10 @@
 
 add_library(poppler-cpp SHARED ${poppler_cpp_SRCS})
 set_target_properties(poppler-cpp PROPERTIES VERSION 0.3.0 SOVERSION 0)
+if(MINGW)
+    get_target_property(POPPLER_CPP_SOVERSION poppler-cpp SOVERSION)
+    set_target_properties(poppler-cpp PROPERTIES SUFFIX "-${POPPLER_CPP_SOVERSION}${CMAKE_SHARED_LIBRARY_SUFFIX}")
+endif()
 target_link_libraries(poppler-cpp poppler ${ICONV_LIBRARIES})
 install(TARGETS poppler-cpp RUNTIME DESTINATION bin LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
 
diff --git a/glib/CMakeLists.txt b/glib/CMakeLists.txt
index a34b929..e089ef8 100644
--- a/glib/CMakeLists.txt
+++ b/glib/CMakeLists.txt
@@ -82,6 +82,10 @@
 )
 add_library(poppler-glib SHARED ${poppler_glib_SRCS} ${poppler_glib_generated_SRCS})
 set_target_properties(poppler-glib PROPERTIES VERSION 8.9.0 SOVERSION 8)
+if(MINGW)
+    get_target_property(POPPLER_GLIB_SOVERSION poppler-glib SOVERSION)
+    set_target_properties(poppler-glib PROPERTIES SUFFIX "-${POPPLER_GLIB_SOVERSION}${CMAKE_SHARED_LIBRARY_SUFFIX}")
+endif()
 target_link_libraries(poppler-glib poppler ${GLIB2_LIBRARIES} ${CAIRO_LIBRARIES} ${FREETYPE_LIBRARIES})
 if(CMAKE_USE_PTHREADS_INIT)
    target_link_libraries(poppler-glib Threads::Threads)
diff --git a/qt4/src/CMakeLists.txt b/qt4/src/CMakeLists.txt
index 55ca97b..f654772 100644
--- a/qt4/src/CMakeLists.txt
+++ b/qt4/src/CMakeLists.txt
@@ -31,6 +31,10 @@
 qt4_automoc(${poppler_qt4_SRCS})
 add_library(poppler-qt4 SHARED ${poppler_qt4_SRCS})
 set_target_properties(poppler-qt4 PROPERTIES VERSION 4.11.0 SOVERSION 4)
+if(MINGW)
+    get_target_property(POPPLER_QT4_SOVERSION poppler-qt4 SOVERSION)
+    set_target_properties(poppler-qt4 PROPERTIES SUFFIX "-${POPPLER_QT4_SOVERSION}${CMAKE_SHARED_LIBRARY_SUFFIX}")
+endif()
 target_link_libraries(poppler-qt4 poppler ${QT4_QTCORE_LIBRARY} ${QT4_QTGUI_LIBRARY} ${QT4_QTXML_LIBRARY})
 if(MSVC)
 target_link_libraries(poppler-qt4 poppler ${poppler_LIBS})
diff --git a/qt5/src/CMakeLists.txt b/qt5/src/CMakeLists.txt
index 113140a..7993c33 100644
--- a/qt5/src/CMakeLists.txt
+++ b/qt5/src/CMakeLists.txt
@@ -31,6 +31,10 @@
 )
 add_library(poppler-qt5 SHARED ${poppler_qt5_SRCS})
 set_target_properties(poppler-qt5 PROPERTIES VERSION 1.11.0 SOVERSION 1)
+if(MINGW)
+    get_target_property(POPPLER_QT5_SOVERSION poppler-qt5 SOVERSION)
+    set_target_properties(poppler-qt5 PROPERTIES SUFFIX "-${POPPLER_QT5_SOVERSION}${CMAKE_SHARED_LIBRARY_SUFFIX}")
+endif()
 target_link_libraries(poppler-qt5 poppler ${Qt5Core_LIBRARIES} ${Qt5Gui_LIBRARIES} ${Qt5Xml_LIBRARIES})
 if(MSVC)
 target_link_libraries(poppler-qt5 poppler ${poppler_LIBS})