From 8b328d862ff2de0f789fb0b0287d350f9ed27dbc Mon Sep 17 00:00:00 2001
From: Christian Grefe <Christian.Grefe@cern.ch>
Date: Tue, 15 Jul 2014 11:20:11 +0000
Subject: [PATCH] Missing updates for depending CMakeLists using external
 DDSegmentation installation

---
 DDCore/CMakeLists.txt              | 14 ++++++++++----
 DDCore/include/DD4hep/Dictionary.h |  1 +
 DDRec/CMakeLists.txt               | 12 +++++++++---
 3 files changed, 20 insertions(+), 7 deletions(-)

diff --git a/DDCore/CMakeLists.txt b/DDCore/CMakeLists.txt
index 3ce3fffa7..9c80a0504 100644
--- a/DDCore/CMakeLists.txt
+++ b/DDCore/CMakeLists.txt
@@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 2.8.3 FATAL_ERROR)
 
 project(DDCore)
 
-include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include ${ROOT_INCLUDE_DIR} ${CMAKE_SOURCE_DIR}/DDSegmentation/include )
+include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include ${ROOT_INCLUDE_DIR} ${DDSegmentation_INCLUDE_DIR} )
 
 
 file(GLOB sources src/*.cpp src/Evaluator/*.cpp src/XML/*.cpp)
@@ -22,10 +22,16 @@ else()
   file(GLOB parser_sources )
 endif()
 
+# Find the DDSegmentation libraries
+find_library(DDSegmentation_LIBS
+  NAMES ${DDSegmentation_LIBRARIES}
+  PATHS ${DDSegmentation_LIBRARY_DIR}
+)
+
 file(GLOB headers include/DD4hep/*.h)
 file(GLOB internal_headers include/DD4hep/objects/*.h)
-list(APPEND headers ${CMAKE_SOURCE_DIR}/DDSegmentation/include/DDSegmentation/BitField64.h)
-list(APPEND headers ${CMAKE_SOURCE_DIR}/DDSegmentation/include/DDSegmentation/Segmentation.h)
+list(APPEND headers ${DDSegmentation_INCLUDE_DIR}/DDSegmentation/BitField64.h)
+list(APPEND headers ${DDSegmentation_INCLUDE_DIR}/DDSegmentation/Segmentation.h)
 list(REMOVE_ITEM headers ${CMAKE_CURRENT_SOURCE_DIR}/include/DD4hep/DetFactoryHelper.h
   ${CMAKE_CURRENT_SOURCE_DIR}/include/DD4hep/Factories.h
   ${CMAKE_CURRENT_SOURCE_DIR}/include/DD4hep/Plugins.h
@@ -42,7 +48,7 @@ include(DD4hep_XML_setup)
 
 add_library(DD4hepCore SHARED ${sources} ${parser_sources} )
 
-target_link_libraries(DD4hepCore ${ROOT_LIBRARIES} ${XML_LIBRARIES} DDSegmentation Geom Reflex ${libraries})
+target_link_libraries(DD4hepCore ${ROOT_LIBRARIES} ${XML_LIBRARIES} ${DDSegmentation_LIBS} Geom Reflex ${libraries})
 
 add_library(DD4hepPlugins SHARED ${plugin_sources})
 target_link_libraries(DD4hepPlugins ${ROOT_LIBRARIES} ${XML_LIBRARIES} DD4hepCore Geom Reflex ${libraries})
diff --git a/DDCore/include/DD4hep/Dictionary.h b/DDCore/include/DD4hep/Dictionary.h
index c55722a75..3f5941e24 100644
--- a/DDCore/include/DD4hep/Dictionary.h
+++ b/DDCore/include/DD4hep/Dictionary.h
@@ -266,6 +266,7 @@ template vector<pair<string, int> >::iterator;
 #include "DDSegmentation/ProjectiveCylinder.h"
 #include "DDSegmentation/SegmentationParameter.h"
 #include "DDSegmentation/TiledLayerSegmentation.h"
+typedef DD4hep::DDSegmentation::VolumeID VolumeID;
 typedef DD4hep::DDSegmentation::CellID CellID;
 
 #ifdef __CINT__
diff --git a/DDRec/CMakeLists.txt b/DDRec/CMakeLists.txt
index 062dd8590..2a0ea9dd8 100644
--- a/DDRec/CMakeLists.txt
+++ b/DDRec/CMakeLists.txt
@@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.0 FATAL_ERROR)
 project(DDRec)
 
 include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include 
-		    ${ROOT_INCLUDE_DIR} ${CMAKE_SOURCE_DIR}/DDSegmentation/include 
+		    ${DDSegmentation_INCLUDE_DIR}
 		    ${ROOT_INCLUDE_DIR} ${CMAKE_SOURCE_DIR}/DDSurfaces/include 
 		    ${CMAKE_SOURCE_DIR}/DDCore/include)
 
@@ -26,8 +26,14 @@ endif()
 
 add_library(DD4hepRec SHARED ${sources} )
 
+# Find the DDSegmentation libraries
+find_library(DDSegmentation_LIBS
+  NAMES ${DDSegmentation_LIBRARIES}
+  PATHS ${DDSegmentation_LIBRARY_DIR}
+)
+
 if(DD4HEP_WITH_GEAR)
-  target_link_libraries(DD4hepRec ${ROOT_LIBRARIES} DDSegmentation DD4hepCore Geom Reflex ${libraries} ${GEAR_LIBRARIES} ${GEAR_COMPONENT_LIBRARIES})
+  target_link_libraries(DD4hepRec ${ROOT_LIBRARIES} ${DDSegmentation_LIBS} DD4hepCore Geom Reflex ${libraries} ${GEAR_LIBRARIES} ${GEAR_COMPONENT_LIBRARIES})
 
   #------ binary ----------
   
@@ -39,7 +45,7 @@ if(DD4HEP_WITH_GEAR)
     )
 
 else()
-  target_link_libraries(DD4hepRec ${ROOT_LIBRARIES} DDSegmentation DD4hepCore Geom Reflex ${libraries})
+  target_link_libraries(DD4hepRec ${ROOT_LIBRARIES} ${DDSegmentation_LIBS} DD4hepCore Geom Reflex ${libraries})
 endif(DD4HEP_WITH_GEAR)
 
 
-- 
GitLab