From 642f839868526d0356b7f6887f787fcb0ff044b7 Mon Sep 17 00:00:00 2001
From: Markus Frank <markus.frank@cern.ch>
Date: Fri, 13 Nov 2015 14:43:54 +0000
Subject: [PATCH] Disable Geant4 tests if no DDG4 present

---
 examples/ClientTests/CMakeLists.txt    | 10 +++++-----
 examples/SimpleDetector/CMakeLists.txt | 12 +++++++-----
 2 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/examples/ClientTests/CMakeLists.txt b/examples/ClientTests/CMakeLists.txt
index aec504d95..e055f108a 100644
--- a/examples/ClientTests/CMakeLists.txt
+++ b/examples/ClientTests/CMakeLists.txt
@@ -12,20 +12,20 @@
 cmake_minimum_required(VERSION 2.8.3 FATAL_ERROR)
 include ( ${DD4hep_DIR}/cmake/DD4hep.cmake )
 
-#-----------------------------------------------------------------------------------
+#--------------------------------------------------------------------------
 dd4hep_configure_output()
 dd4hep_package (ClientTests MAJOR 0 MINOR 0 PATCH 1
   USES         [ROOT   REQUIRED COMPONENTS Geom GenVector] 
                [DD4hep REQUIRED COMPONENTS DDCore]
   OPTIONAL     XERCESC
   INCLUDE_DIRS include )
-#-----------------------------------------------------------------------------------
+#--------------------------------------------------------------------------
 dd4hep_add_plugin( ClientTests SOURCES src/*.cpp  )
 dd4hep_install_dir( compact scripts DESTINATION ${DD4hep_DIR}/examples/ClientTests )
-#-----------------------------------------------------------------------------------
+#--------------------------------------------------------------------------
 dd4hep_configure_scripts( ClientTests DEFAULT_SETUP WITH_TESTS)
 
-#***  Testing  *********************************************************************
+#---  Testing  ------------------------------------------------------------
 foreach (test Assemblies BoxTrafos IronCylinder LheD_tracker MagnetFields MaterialTester MiniTel SectorBarrelCalorimeter SiliconBlock NestedSimple NestedDetectors )
   foreach( type lcdd gdml vis )
     dd4hep_add_test_reg( ClientTests_converter_${type}_${test}
@@ -35,7 +35,7 @@ foreach (test Assemblies BoxTrafos IronCylinder LheD_tracker MagnetFields Materi
   endforeach(type)
 endforeach()
 #
-if ( NOT "${DD4HEP_USE_GEANT4}" STREQUAL "" )
+if (DD4HEP_USE_GEANT4)
   foreach(script MiniTel LheD_tracker )
     dd4hep_add_test_reg( ClientTests_sim_${script}
       COMMAND    "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh"
diff --git a/examples/SimpleDetector/CMakeLists.txt b/examples/SimpleDetector/CMakeLists.txt
index e3e9aab0f..0a6eba8ca 100644
--- a/examples/SimpleDetector/CMakeLists.txt
+++ b/examples/SimpleDetector/CMakeLists.txt
@@ -36,8 +36,10 @@ foreach (test Simple_ILD)
   endforeach(type)
 endforeach(test)
 
-dd4hep_add_test_reg( SimpleDetector_sim_ILD
-    COMMAND    "${CMAKE_INSTALL_PREFIX}/bin/run_test_SimpleDetector.sh"
-    EXEC_ARGS  dd_sim ${CMAKE_CURRENT_SOURCE_DIR}/compact/Simple_ILD.xml  ${CMAKE_CURRENT_SOURCE_DIR}/examples/sequences.xml
-    REQUIRES   DDG4 Geant4
-    REGEX_PASS "Event 9 Begin event action")
+if (DD4HEP_USE_GEANT4)
+  dd4hep_add_test_reg( SimpleDetector_sim_ILD
+      COMMAND    "${CMAKE_INSTALL_PREFIX}/bin/run_test_SimpleDetector.sh"
+      EXEC_ARGS  dd_sim ${CMAKE_CURRENT_SOURCE_DIR}/compact/Simple_ILD.xml  ${CMAKE_CURRENT_SOURCE_DIR}/examples/sequences.xml
+      REQUIRES   DDG4 Geant4
+      REGEX_PASS "Event 9 Begin event action")
+endif()
-- 
GitLab