From 32b1ae5cd6eb05f2b9c6272e65711bb56a51f16c Mon Sep 17 00:00:00 2001
From: Frank Gaede <frank.gaede@desy.de>
Date: Wed, 17 Apr 2013 12:10:58 +0000
Subject: [PATCH]   - activated ILD examples again:     LCIO can be either
 given on the cmake command line     or it will be build as external project

---
 CMakeLists.txt                      |  9 +++---
 DDExamples/ILDExDet/CMakeLists.txt  | 44 ++++++++++++++++++++++++++---
 DDExamples/ILDExSimu/CMakeLists.txt |  1 -
 3 files changed, 45 insertions(+), 9 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index cfe10d5a1..1281f4992 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -36,10 +36,11 @@ add_subdirectory(DDExamples/UtilityApps)
 add_subdirectory(DDExamples/AlignDet)
 add_subdirectory(DDExamples/CLICSiD)
 
-## Cannot use these ones anymore, since Frank has introduced lcio.....
-##add_subdirectory(DDExamples/ILDExDet)
-##add_subdirectory(DDExamples/ILDExReco)
-##add_subdirectory(DDExamples/ILDExTest)
+## --- ILD examples ----- 
+add_subdirectory(DDExamples/ILDExDet)
+add_subdirectory(DDExamples/ILDExReco)
+add_subdirectory(DDExamples/ILDExTest)
+
 if(DD4HEP_WITH_GEANT4)
    add_subdirectory(DDExamples/CLICSiDSimu)
 endif()
diff --git a/DDExamples/ILDExDet/CMakeLists.txt b/DDExamples/ILDExDet/CMakeLists.txt
index a3844bbf5..a78f7581e 100644
--- a/DDExamples/ILDExDet/CMakeLists.txt
+++ b/DDExamples/ILDExDet/CMakeLists.txt
@@ -1,11 +1,47 @@
 cmake_minimum_required(VERSION 2.8.3 FATAL_ERROR)
 
-##find_package(LCIO REQUIRED) 
+
+#----- check if LCIO is available
+find_package(LCIO QUIET) 
+
+if( NOT LCIO_FOUND ) # downlaod and build LCIO
+
+  INCLUDE( ExternalProject )
+
+  set( lcio_download_url SVN_REPOSITORY "svn://svn.freehep.org/lcio/trunk" )
+  
+  set( lcio_cmake_args
+    "-DINSTALL_JAR=OFF"
+    "-DBUILD_LCIO_EXAMPLES=OFF"
+    "-DBUILD_ROOTDICT=OFF"
+    "-DBUILD_F77_TESTJOBS=OFF"
+    )
+
+  ExternalProject_Add( LCIO
+    ${lcio_download_url}
+    CMAKE_ARGS ${lcio_cmake_args}
+    PREFIX ${DD4hep_SOURCE_DIR}/dependencies
+    )
+
+  MESSAGE( STATUS "===============  Adding LCIO as external project  ====================" ) 
+  MESSAGE( STATUS "   to use an existing LCIO installation please specify -D LCIO_DIR=path_to_lcio !! " )
+  MESSAGE( STATUS "======================================================================" ) 
+  
+  set(LCIO_INCLUDE_DIRS "${DD4hep_SOURCE_DIR}/dependencies/src/LCIO/include" )
+  
+  set(LCIO_LIBRARIES 
+    "${DD4hep_SOURCE_DIR}/dependencies/src/LCIO/lib/${CMAKE_SHARED_LIBRARY_PREFIX}sio${CMAKE_SHARED_LIBRARY_SUFFIX}"
+    "${DD4hep_SOURCE_DIR}/dependencies/src/LCIO/lib/${CMAKE_SHARED_LIBRARY_PREFIX}lcio${CMAKE_SHARED_LIBRARY_SUFFIX}"
+    )
+
+endif()
+#-------------- lcio -------------------
+
 
 include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/include
-                     ${CMAKE_SOURCE_DIR}/DDCore/include 
-                     ${ROOT_INCLUDE_DIR}
-		     ${LCIO_INCLUDE_DIRS})
+  ${CMAKE_SOURCE_DIR}/DDCore/include 
+  ${ROOT_INCLUDE_DIR}
+  ${LCIO_INCLUDE_DIRS})
 
 file(GLOB sources src/*.cpp src/compact/*.cpp)
 file(GLOB headers include/*.h)
diff --git a/DDExamples/ILDExSimu/CMakeLists.txt b/DDExamples/ILDExSimu/CMakeLists.txt
index 4b89b65e8..8820b078b 100644
--- a/DDExamples/ILDExSimu/CMakeLists.txt
+++ b/DDExamples/ILDExSimu/CMakeLists.txt
@@ -11,7 +11,6 @@ endif()
 find_package(LCIO REQUIRED) 
 
 
-
 include_directories( ${CMAKE_SOURCE_DIR}/DDCore/include
                      ${CMAKE_SOURCE_DIR}/DDG4/include
                      ${CMAKE_CURRENT_SOURCE_DIR}/include
-- 
GitLab