Windows: only set SOVERSION for shared libs
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b9d1dfb..6aaaa76 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -485,7 +485,7 @@
 add_library(poppler ${poppler_SRCS})
 endif()
 set_target_properties(poppler PROPERTIES VERSION 83.0.0 SOVERSION 83)
-if(MINGW)
+if(MINGW AND BUILD_SHARED_LIBS)
     get_target_property(POPPLER_SOVERSION poppler SOVERSION)
     set_target_properties(poppler PROPERTIES SUFFIX "-${POPPLER_SOVERSION}${CMAKE_SHARED_LIBRARY_SUFFIX}")
 endif()
diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt
index 78a57be..b953d5c 100644
--- a/cpp/CMakeLists.txt
+++ b/cpp/CMakeLists.txt
@@ -25,7 +25,7 @@
 
 add_library(poppler-cpp ${poppler_cpp_SRCS})
 set_target_properties(poppler-cpp PROPERTIES VERSION 0.5.0 SOVERSION 0)
-if(MINGW)
+if(MINGW AND BUILD_SHARED_LIBS)
     get_target_property(POPPLER_CPP_SOVERSION poppler-cpp SOVERSION)
     set_target_properties(poppler-cpp PROPERTIES SUFFIX "-${POPPLER_CPP_SOVERSION}${CMAKE_SHARED_LIBRARY_SUFFIX}")
 endif()
diff --git a/glib/CMakeLists.txt b/glib/CMakeLists.txt
index ecdd38c..6958caf 100644
--- a/glib/CMakeLists.txt
+++ b/glib/CMakeLists.txt
@@ -90,7 +90,7 @@
 set_target_properties(poppler-glib PROPERTIES C_VISIBILITY_PRESET hidden)
 set_target_properties(poppler-glib PROPERTIES CXX_VISIBILITY_PRESET hidden)
 set_target_properties(poppler-glib PROPERTIES VISIBILITY_INLINES_HIDDEN 1)
-if(MINGW)
+if(MINGW AND BUILD_SHARED_LIBS)
     get_target_property(POPPLER_GLIB_SOVERSION poppler-glib SOVERSION)
     set_target_properties(poppler-glib PROPERTIES SUFFIX "-${POPPLER_GLIB_SOVERSION}${CMAKE_SHARED_LIBRARY_SUFFIX}")
 endif()
diff --git a/qt5/src/CMakeLists.txt b/qt5/src/CMakeLists.txt
index 4da5e57..731e8fa 100644
--- a/qt5/src/CMakeLists.txt
+++ b/qt5/src/CMakeLists.txt
@@ -39,7 +39,7 @@
 )
 add_library(poppler-qt5 ${poppler_qt5_SRCS})
 set_target_properties(poppler-qt5 PROPERTIES VERSION 1.17.0 SOVERSION 1)
-if(MINGW)
+if(MINGW AND BUILD_SHARED_LIBS)
     get_target_property(POPPLER_QT5_SOVERSION poppler-qt5 SOVERSION)
     set_target_properties(poppler-qt5 PROPERTIES SUFFIX "-${POPPLER_QT5_SOVERSION}${CMAKE_SHARED_LIBRARY_SUFFIX}")
 endif()