From 68e685464a20971c9e5e6ebe4c4a2aae2c90fb72 Mon Sep 17 00:00:00 2001
From: Markus Frank <Markus.Frank@cern.ch>
Date: Fri, 15 Nov 2019 12:04:35 +0100
Subject: [PATCH] Enable DDCMS for Geant4 builtin CLHEP

---
 examples/DDCMS/CMakeLists.txt | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/examples/DDCMS/CMakeLists.txt b/examples/DDCMS/CMakeLists.txt
index 1750e3297..0f61b7ad8 100644
--- a/examples/DDCMS/CMakeLists.txt
+++ b/examples/DDCMS/CMakeLists.txt
@@ -23,13 +23,25 @@ ENDIF()
 
 dd4hep_set_compiler_flags()
 #==========================================================================
+set (Geant4_builtin_clhep_FOUND ON)
+# Configure Geant4
+if(DD4HEP_USE_GEANT4)
+  find_package( Geant4 REQUIRED )
+  if(NOT Geant4_builtin_clhep_FOUND)
+    SET(DD4HEP_USE_CLHEP TRUE)
+  else()
+    include_directories(${Geant4_INCLUDE_DIRS})
+  endif()
+  dd4hep_print("|++> Setup Geant4 targets.")
+  DD4HEP_SETUP_GEANT4_TARGETS()
+endif()
 
 # CLHEP dependent stuff
 if(NOT TARGET CLHEP::CLHEP)
   # ensure we only look for CLHEP once
   find_package(CLHEP QUIET)
 endif()
-if (TARGET CLHEP::CLHEP)
+if (TARGET CLHEP::CLHEP OR Geant4_builtin_clhep_FOUND)
   dd4hep_print("|++> CLHEP PRESENT. Building DDCMS examples.")
 else()
   dd4hep_print("|++> CLHEP is not present. NOT building DDCMS examples.")
-- 
GitLab