diff --git a/cmake/modules/RootBuildOptions.cmake b/cmake/modules/RootBuildOptions.cmake
index e5ef70ef5d6e5080008e1ae994a030e6aea4f977..6297637d06d12c2b32f37ad5698ae850020197da 100644
--- a/cmake/modules/RootBuildOptions.cmake
+++ b/cmake/modules/RootBuildOptions.cmake
@@ -126,6 +126,7 @@ ROOT_BUILD_OPTION(macos_native OFF "Disable looking for libraries, includes and
 ROOT_BUILD_OPTION(mathmore ON "Build libMathMore extended math library (requires GSL)")
 ROOT_BUILD_OPTION(memory_termination OFF "Free internal ROOT memory before process termination (experimental, used for leak checking)")
 ROOT_BUILD_OPTION(memstat OFF "Build memory statistics utility (helps to detect memory leaks)")
+ROOT_BUILD_OPTION(mlp ON "Enable support for TMultilayerPerceptron classes' federation")
 ROOT_BUILD_OPTION(minuit2 OFF "Build Minuit2 minimization library")
 ROOT_BUILD_OPTION(monalisa OFF "Enable support for monitoring with Monalisa (requires libapmoncpp)")
 ROOT_BUILD_OPTION(mysql ON "Enable support for MySQL databases")
diff --git a/cmake/modules/SearchInstalledSoftware.cmake b/cmake/modules/SearchInstalledSoftware.cmake
index 6bc0e16ca3f20c5216a56dbb503b40a85050d58b..be9d408f0fbf7465d42ebd2bad7cf6ffcab97dd1 100644
--- a/cmake/modules/SearchInstalledSoftware.cmake
+++ b/cmake/modules/SearchInstalledSoftware.cmake
@@ -1331,6 +1331,11 @@ if(cuda OR tmva-gpu)
 endif()
 
 #---TMVA and its dependencies------------------------------------------------------------
+if (tmva AND NOT mlp)
+  message(STATUS "TMVA is enabled while MLP is not: disabling TMVA")
+  set(tmva OFF CACHE BOOL "Disabled because mlp was not activated" FORCE)
+endif()
+
 if(tmva)
   if(tmva-cpu AND imt)
     message(STATUS "Looking for BLAS for optional parts of TMVA")
diff --git a/math/CMakeLists.txt b/math/CMakeLists.txt
index 18955db66a38223403e7d516c6d8088b84b216bb..7c8fe755d00a8f74436d035f27683587120e1e54 100644
--- a/math/CMakeLists.txt
+++ b/math/CMakeLists.txt
@@ -9,7 +9,9 @@ if(minuit2)
 endif()
 add_subdirectory(fumili)
 add_subdirectory(physics)
-add_subdirectory(mlp)
+if(mlp)
+   add_subdirectory(mlp)
+endif(mlp)
 add_subdirectory(quadp)
 add_subdirectory(foam)
 add_subdirectory(smatrix)
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 91c4a8b2304ab6538e979801e80442c00f7f03f0..776cb9e8f07eccf82c1ee459fe71ad6d0cb966a0 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -271,7 +271,7 @@ ROOT_EXECUTABLE(stressHepix stressHepix.cxx LIBRARIES Core)
 #ROOT_ADD_TEST(test-stressHepix COMMAND stressHepix FAILREGEX "FAILED|Error in")
 
 #--stressProof-------------------------------------------------------------------------------
-if(NOT WIN32)
+if(proof AND NOT WIN32)
   add_custom_target(TestData COMMAND ${CMAKE_COMMAND} -DDST=${CMAKE_SOURCE_DIR}/files -P ${CMAKE_CURRENT_SOURCE_DIR}/rootDownloadData.cmake)
   ROOT_EXECUTABLE(stressProof stressProof.cxx LIBRARIES Proof ProofPlayer Hist)
   ROOT_ADD_TEST(test-stressproof PRECMD ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} --target TestData