diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt
index 63cdef8..0c5b50a 100644
--- a/doc/CMakeLists.txt
+++ b/doc/CMakeLists.txt
@@ -3,22 +3,30 @@ if( UNIX )
     add_subdirectory(cervisia)
   endif()
 endif( UNIX )
-add_subdirectory(kapptemplate)
+if(BUILD_kapptemplate)
+  add_subdirectory(kapptemplate)
+endif()
 if(BUILD_kbugbuster)
   add_subdirectory(kbugbuster)
 endif()
 if(BUILD_kcachegrind)
   add_subdirectory(kcachegrind)
 endif()
-add_subdirectory(kmtrace)
+if(BUILD_kmtrace)
+  add_subdirectory(kmtrace)
+endif()
 if(BUILD_kompare)
   add_subdirectory(kompare)
 endif()
 if(BUILD_lokalize)
   add_subdirectory(lokalize)
 endif()
-add_subdirectory(poxml)
-add_subdirectory(scripts)
+if(BUILD_poxml)
+  add_subdirectory(poxml)
+endif()
+if(BUILD_scripts)
+  add_subdirectory(scripts)
+endif()
 
 if(LIBXSLT_FOUND AND LIBXML2_FOUND)
   if(BUILD_umbrello)
