diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1e744f6f7f398007fb2371bde4253549a1f023ef..9bfa4207ae94b1e62dcd6124d8d41dcdf0bc6a4a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -269,7 +269,9 @@ if(BA_TESTS)
 endif()
 
 # documentation
-if(BORNAGAIN_PYTHON) # required for examples
+# TODO: 'hugo' depends on 'excopy' and 'figures' which are produced in Tests/Examples
+# The tests and documentation should be decoupled.
+if(BORNAGAIN_PYTHON AND BA_TESTS) # required for examples
     add_subdirectory(hugo)
 endif()
 add_subdirectory(Doc/man)