--- a/qpdf/CMakeLists.txt
+++ b/qpdf/CMakeLists.txt
@@ -65,7 +65,7 @@
   TYPE RUNTIME
   COMPONENT ${COMPONENT_CLI})
 
-if(MINGW)
+if(MINGW AND INSTALL_EXTRA_DLLS)
   # For MSVC, including InstallRequiredSystemLibraries in the
   # top-level CMakeLists.txt is sufficient. For mingw, we have to copy
   # mingw libraries in ourselves.
