diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt
index d90dcb80c675b9078cdcf4b7e64f39d01f94effd..1b3f23f5d305268b8060193a8c7d3a9c5b9a89f9 100644
--- a/doc/CMakeLists.txt
+++ b/doc/CMakeLists.txt
@@ -1,9 +1,17 @@
+include(FindPythonModule) # required for find_python_module
+
 find_package(Sphinx)
 add_target_if(SPHINX_FOUND
     check-sphinx
     "Finding Sphinx"
     "Sphinx must be installed to build documentation")
 
+find_python_module(svgwrite)
+add_target_if(HAVE_SVGWRITE
+    ext-svgwrite
+    "Finding svgwrite"
+    "The Python module svgwrite needs to be installed to build documentation. Use pip to install svgwrite")
+
 set(html_dir "${CMAKE_CURRENT_BINARY_DIR}/html")
 set(doctree_dir "${CMAKE_CURRENT_BINARY_DIR}/_doctrees")
 
@@ -19,7 +27,7 @@ add_custom_target(html
         -q                          # Quiet: no output other than errors and warnings.
         ${CMAKE_CURRENT_SOURCE_DIR} # Source directory
         ${html_dir}                 # Output directory
-    DEPENDS check-sphinx ext-sphinx_rtd_theme
+    DEPENDS check-sphinx ext-sphinx_rtd_theme ext-svgwrite
     COMMENT
         "Generating Sphinx documentation")