From 7f95839db810995a134609d43f36c8d787673bc4 Mon Sep 17 00:00:00 2001
From: Frank Gaede <frank.gaede@desy.de>
Date: Thu, 28 Nov 2013 14:56:31 +0000
Subject: [PATCH]  - made  building with LCIO more standard:    -D
 DD4HEP_USE_LCIO=1 ( -D LCIO_DIR=_lcio_install_dir_ )      - LCIO_DIR is not
 needed when iLCSoft is initialized

---
 DDG4/CMakeLists.txt | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/DDG4/CMakeLists.txt b/DDG4/CMakeLists.txt
index 5ff739565..605c9d178 100644
--- a/DDG4/CMakeLists.txt
+++ b/DDG4/CMakeLists.txt
@@ -16,7 +16,7 @@ include_directories(${CMAKE_SOURCE_DIR}/DDCore/include
                     ${CMAKE_CURRENT_SOURCE_DIR}/include 
                     ${ROOT_INCLUDE_DIR}
                     ${CLHEP_INCLUDE_DIR}
-                    ${Geant4_INCLUDE_DIRS} ${LCIO_DIR}/include )
+                    ${Geant4_INCLUDE_DIRS} ) #${LCIO_DIR}/include )
 
 #---Add Library-------------------------------------------------------------------
 if(DD4HEP_USE_BOOST)
@@ -69,11 +69,18 @@ else()
 endif()
 
 #---------------------------  LCIO Plugins for new simulation framework  -----------
-if(LCIO_DIR)
-  list(APPEND include_directories ${LCIO_DIR}/include)
+#if(LCIO_DIR)
+#  list(APPEND include_directories ${LCIO_DIR}/include)
+
+if(DD4HEP_USE_LCIO)
+  find_package(LCIO REQUIRED)
+  include_directories(  ${LCIO_INCLUDE_DIRS} )
+
   file(GLOB lcio_sources lcio/*.cpp)
   add_library(DD4hepG4LCIO SHARED ${lcio_sources})
-  target_link_libraries(DD4hepG4LCIO DD4hepCore DD4hepG4 ${Geant4_LIBRARIES} -L${LCIO_DIR}/lib -llcio ${ROOT_LIBRARIES} Reflex)
+
+  target_link_libraries(DD4hepG4LCIO DD4hepCore DD4hepG4 ${Geant4_LIBRARIES} ${LCIO_LIBRARIES} ${ROOT_LIBRARIES} Reflex)
+
   SET_TARGET_PROPERTIES(DD4hepG4LCIO PROPERTIES VERSION ${DD4hep_VERSION} SOVERSION ${DD4hep_SOVERSION})
   dd4hep_generate_rootmap(DD4hepG4LCIO)
 endif()
-- 
GitLab