diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7f3859c1d17a46f8c2f5454ef7572db39dbe43e2..beb79029b0d9ac093610957475e7bacafebf16c4 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -35,7 +35,9 @@ IF(BUILD_PYTHON_INTERFACE)
   FINDPYTHON()
   STRING(REGEX REPLACE "-" "_" PY_NAME ${PROJECT_NAME})
   ADD_SUBDIRECTORY(python)
-  ADD_SUBDIRECTORY(unittest)
+  IF(BUILD_TESTING)
+    ADD_SUBDIRECTORY(unittest)
+  ENDIF(BUILD_TESTING)
 ENDIF(BUILD_PYTHON_INTERFACE)
 
 IF(NOT INSTALL_PYTHON_INTERFACE_ONLY)