--- CMakeLists.txt.orig	2021-09-15 13:04:13 UTC
+++ CMakeLists.txt
@@ -92,7 +92,7 @@ set( CMAKE_INSTALL_DATADIR "share/${PROJECT_NAME}" CAC
 ################################################################################
 
 # needed for pynest test suite
-if ( ${with-python} STREQUAL "ON" )
+if ( BUILD_PYTHON AND ${with-python} STREQUAL "ON" )
   find_program( NOSETESTS NAMES nosetests )
 endif ()
 
@@ -194,7 +194,7 @@ message("-- NEST version: ${NEST_VERSION_STRING}")
 enable_testing()
 set( TEST_OPTS "" )
 
-if ( HAVE_PYTHON )
+if ( BUILD_PYTHON AND HAVE_PYTHON )
   set( TEST_OPTS "${TEST_OPTS};--with-python=${PYTHON}" )
 endif ()
 
@@ -223,8 +223,12 @@ add_custom_target( installcheck
 ##################        Define Subdirectories here          ##################
 ################################################################################
 
-add_subdirectory( doc )
-add_subdirectory( examples )
+if (INSTALL_DOCS)
+  add_subdirectory( doc )
+endif()
+if (INSTALL_EXAMPLES)
+  add_subdirectory( examples )
+endif()
 add_subdirectory( extras )
 add_subdirectory( lib )
 add_subdirectory( libnestutil )
@@ -234,7 +238,7 @@ add_subdirectory( nest )
 add_subdirectory( nestkernel )
 add_subdirectory( thirdparty )
 add_subdirectory( testsuite )
-if ( HAVE_PYTHON )
+if ( BUILD_PYTHON AND HAVE_PYTHON )
   add_subdirectory( pynest )
 endif ()
 
