From 6dbec2c8765a5dd5ee430a828f8bf5b2c4c591bb Mon Sep 17 00:00:00 2001
From: Danilo Piparo <danilo.piparo@cern.ch>
Date: Mon, 3 Jun 2019 23:38:24 +0200
Subject: [PATCH] [CMake] Make MLP optional, by default ON

---
 cmake/modules/RootBuildOptions.cmake        | 1 +
 cmake/modules/SearchInstalledSoftware.cmake | 5 +++++
 math/CMakeLists.txt                         | 4 +++-
 test/CMakeLists.txt                         | 2 +-
 4 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/cmake/modules/RootBuildOptions.cmake b/cmake/modules/RootBuildOptions.cmake
index e5ef70ef5d6..6297637d06d 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 6bc0e16ca3f..be9d408f0fb 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 18955db66a3..7c8fe755d00 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 91c4a8b2304..776cb9e8f07 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
-- 
GitLab