diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1666dce50bb4d9a554bc7c05ac004ce075740552..e13b2a9167c488611fc68a53307c55ae9bc8e692 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -91,48 +91,7 @@ dd4hep_configure_output( OUTPUT "${PROJECT_BINARY_DIR}" INSTALL "${CMAKE_INSTALL
 find_package(ROOT 6.08 REQUIRED) # COMPONENTS Geom GenVector Eve Gui Graf3d RGL EG
 #include(${ROOT_USE_FILE})
 
-
-ADD_LIBRARY(ROOT::Interface INTERFACE IMPORTED GLOBAL)
-
-#ROOT CXX Flags are a string with quotes, not a list, so we need to convert to a list...
-string(REPLACE " " ";" ROOT_CXX_FLAGS ${ROOT_CXX_FLAGS})
-
-SET_TARGET_PROPERTIES(ROOT::Interface
-  PROPERTIES
-  INTERFACE_COMPILE_OPTIONS "${ROOT_CXX_FLAGS}"
-  INTERFACE_INCLUDE_DIRECTORIES ${ROOT_INCLUDE_DIRS}
-  )
-
-foreach(LIB Core RIO Net Hist Graf Graf3d Gpad Tree Rint Postscript Matrix Physics MathCore Thread MultiProc)
-  ADD_LIBRARY(ROOT::${LIB} SHARED IMPORTED GLOBAL)
-  MESSAGE(STATUS "ROOT lib location ${LIB} ${ROOT_${LIB}_LIBRARY}")
-  SET_TARGET_PROPERTIES(ROOT::${LIB}
-    PROPERTIES
-    INTERFACE_COMPILE_OPTIONS "${ROOT_CXX_FLAGS}"
-    INTERFACE_INCLUDE_DIRECTORIES ${ROOT_INCLUDE_DIRS}
-    IMPORTED_LOCATION ${ROOT_${LIB}_LIBRARY}
-    )
-  TARGET_LINK_LIBRARIES(ROOT::Interface INTERFACE ROOT::${LIB})
-endforeach()
-
-foreach(LIB PyROOT Geom GenVector)
-  ADD_LIBRARY(ROOT::${LIB} SHARED IMPORTED GLOBAL)
-  MESSAGE(STATUS "ROOT lib location ${LIB} ${G4_LIB_TEMP_${LIB}}")
-  SET_TARGET_PROPERTIES(ROOT::${LIB}
-    PROPERTIES
-    INTERFACE_COMPILE_OPTIONS "${ROOT_CXX_FLAGS}"
-    INTERFACE_INCLUDE_DIRECTORIES ${ROOT_INCLUDE_DIRS}
-    IMPORTED_LOCATION ${ROOT_${LIB}_LIBRARY}
-    )
-endforeach()
-
-MESSAGE(STATUS "ROOT Libraries ${ROOT_LIBRARIES}")
-MESSAGE(STATUS "ROOT CXX_FLAGS ${ROOT_CXX_FLAGS}")
-MESSAGE(STATUS "ROOT INCL DIRS ${ROOT_INCLUDE_DIRS}")
-MESSAGE(STATUS "ROOT_VERSION: ${ROOT_VERSION}" )
-GET_PROPERTY(IMP_LOC TARGET ROOT::Core PROPERTY IMPORTED_LOCATION)
-MESSAGE(STATUS "ROOT_IMP_LOC: ${IMP_LOC}" )
-
+DD4HEP_SETUP_ROOT_TARGETS()
 
 ###################
 # Configure BOOST #
@@ -143,7 +102,6 @@ SET_TARGET_PROPERTIES(Boost::boost
   INTERFACE_COMPILE_DEFINITIONS BOOST_SPIRIT_USE_PHOENIX_V3
   )
 
-
 ######################
 # Set compiler flags #
 ######################
@@ -174,10 +132,14 @@ add_subdirectory(DDDigi)
 add_subdirectory(DDG4)
 
 # Note the order: DDEve partially depends on variables from DDG4!
-#add_subdirectory(DDEve)
+add_subdirectory(DDEve)
 
-# dd4hep_enable_tests( DDTest )
-# add_subdirectory(UtilityApps)
+include(CTest)
+
+if(BUILD_TESTING)
+  add_subdirectory(DDTest)
+endif()
+add_subdirectory(UtilityApps)
 
 #######################
 # Treatment for Apple #
@@ -217,7 +179,7 @@ display_std_variables()
 # generate and install following configuration files #
 ######################################################
 
-#dd4hep_generate_package_configuration_files( DD4hepConfig.cmake )
+dd4hep_generate_package_configuration_files( DD4hepConfig.cmake )
 if(APPLE)
   SET ( ENV{DD4HEP_LIBRARY_PATH} $ENV{DYLD_LIBRARY_PATH} )
 else()
@@ -237,7 +199,7 @@ endif()
 
 INSTALL(EXPORT DD4hep 
   NAMESPACE DD4hep::
-  FILE DD4hepConfig.cmake
+  FILE DD4hepConfig-targets.cmake
   DESTINATION lib
   EXPORT_LINK_INTERFACE_LIBRARIES
   )
\ No newline at end of file
diff --git a/cmake/DD4hepBuild.cmake b/cmake/DD4hepBuild.cmake
index eb7faba676c9997b46e94aed6265b9f25e61f455..ad0bdb076aecc0270783d10732eb17d43b190723 100644
--- a/cmake/DD4hepBuild.cmake
+++ b/cmake/DD4hepBuild.cmake
@@ -1415,7 +1415,7 @@ macro ( dd4hep_configure_scripts _pkg )
       dd4hep_install_dir ( compact DESTINATION examples/${_pkg} )
     endif()
   endif()
-  dd4hep_enable_tests ( ${MACRO_ARG_UPARSED_ARGUMENTS} )
+  #dd4hep_enable_tests ( ${MACRO_ARG_UPARSED_ARGUMENTS} )
   unset( PackageName )
 endmacro( dd4hep_configure_scripts )
 
@@ -1635,8 +1635,13 @@ function(new_dd4hep_add_plugin binary)
     set(NOINSTALL NOINSTALL)
   endif()
   file(GLOB SOURCES ${ARG_SOURCES})
+  foreach( f in  ${ARG_GENERATED})
+    set_source_files_properties(${f} PROPERTIES
+      COMPILE_FLAGS "-Wno-unused-function -Wno-overlength-strings"
+      GENERATED TRUE)
+  endforeach()
 
-  ADD_LIBRARY(${binary} SHARED ${SOURCES})
+  ADD_LIBRARY(${binary} SHARED ${SOURCES} ${ARG_GENERATED})
   TARGET_LINK_LIBRARIES(${binary} PUBLIC ${ARG_LINK_LIBRARIES})
   TARGET_INCLUDE_DIRECTORIES(${binary} PUBLIC ${ARG_INCLUDE_DIRS})
   TARGET_COMPILE_DEFINITIONS(${binary} PUBLIC ${ARG_DEFINITIONS})
@@ -1646,3 +1651,129 @@ function(new_dd4hep_add_plugin binary)
   # Generate ROOTMAP if the plugin will be built:
   dd4hep_generate_rootmap( ${binary} )
 endfunction(new_dd4hep_add_plugin)
+
+
+
+
+macro(DD4HEP_SETUP_ROOT_TARGETS)
+
+  #ROOT CXX Flags are a string with quotes, not a list, so we need to convert to a list...
+  string(REPLACE " " ";" ROOT_CXX_FLAGS ${ROOT_CXX_FLAGS})
+
+  IF(NOT TARGET ROOT::Core)
+    #in ROOT before 6.10 there is no ROOT namespace, so we create ROOT::Core ourselves
+    ADD_LIBRARY(ROOT::Core INTERFACE IMPORTED GLOBAL)
+    SET_TARGET_PROPERTIES(ROOT::Core
+      PROPERTIES
+      INTERFACE_COMPILE_OPTIONS "${ROOT_CXX_FLAGS}"
+      INTERFACE_INCLUDE_DIRECTORIES ${ROOT_INCLUDE_DIRS}
+      )
+    # there is also no dependency between the targets
+    TARGET_LINK_LIBRARIES(ROOT::Core INTERFACE Core Rint Tree MathCore Hist Physics)
+    #foreach(LIB Core RIO Net Hist Graf Graf3d Gpad Tree Rint Postscript Matrix Physics MathCore Thread MultiProc)
+    # MESSAGE(STATUS "ROOT lib location ${LIB} ${ROOT_${LIB}_LIBRARY}")
+    # SET_TARGET_PROPERTIES(ROOT::${LIB}
+    #   PROPERTIES
+    #   INTERFACE_COMPILE_OPTIONS "${ROOT_CXX_FLAGS}"
+    #   INTERFACE_INCLUDE_DIRECTORIES ${ROOT_INCLUDE_DIRS}
+    #   IMPORTED_LOCATION ${ROOT_${LIB}_LIBRARY}
+    #   )
+    #endforeach()
+    # Non-standard ROOT components we need later on, we "import" them by hand for now
+    foreach(LIB PyROOT Geom GenVector Eve Graf3d RGL Gui RIO MathCore MathMore)
+      ADD_LIBRARY(ROOT::${LIB} INTERFACE IMPORTED GLOBAL)
+      TARGET_LINK_LIBRARIES(ROOT::${LIB} INTERFACE ${LIB})
+      # SET_TARGET_PROPERTIES(ROOT::${LIB}
+      #   PROPERTIES
+      #   INTERFACE_COMPILE_OPTIONS "${ROOT_CXX_FLAGS}"
+      #   INTERFACE_INCLUDE_DIRECTORIES ${ROOT_INCLUDE_DIRS}
+      #   IMPORTED_LOCATION ${ROOT_${LIB}_LIBRARY}
+      #   )
+    endforeach()
+  ENDIF(NOT TARGET ROOT::Core)
+
+
+  MESSAGE(STATUS "ROOT Libraries ${ROOT_LIBRARIES}")
+  MESSAGE(STATUS "ROOT CXX_FLAGS ${ROOT_CXX_FLAGS}")
+  MESSAGE(STATUS "ROOT INCL DIRS ${ROOT_INCLUDE_DIRS}")
+  MESSAGE(STATUS "ROOT_VERSION: ${ROOT_VERSION}" )
+
+ENDMACRO()
+
+
+MACRO(DD4HEP_SETUP_GEANT4_TARGETS)
+
+  IF(NOT TARGET Geant4::Interface)
+    
+    #include( ${Geant4_USE_FILE} ) # do not use the use file, this is not very considerate...
+    IF((NOT ${Geant4_TLS_MODEL} STREQUAL "global-dynamic") AND NOT ${DD4HEP_IGNORE_GEANT4_TLS})
+      MESSAGE(FATAL_ERROR "Geant4 was built with ${Geant4_TLS_MODEL}, DD4hep requires 'global-dynamic'! Ignore this ERROR with DD4HEP_IGNORE_GEANT4_TLS=True ")
+    ENDIF()
+
+    # if(Geant4_builtin_clhep_FOUND)
+    #   set(CLHEP "")
+    # else()
+    #   FIND_PACKAGE(CLHEP REQUIRED)
+    #   set(CLHEP CLHEP)
+    # endif()
+
+    MESSAGE(STATUS "Geant4 Libraries ${Geant4_LIBRARIES}")
+    MESSAGE(STATUS "Geant4 CXX_FLAGS ${Geant4_CXX_FLAGS}")
+    MESSAGE(STATUS "Geant4 INCL DIRS ${Geant4_INCLUDE_DIRS}")
+    MESSAGE(STATUS "Geant4_VERSION: ${Geant4_VERSION}" )
+
+    # Geant4::10.2.2 at least, not in 10.5 (check where it switches)
+    # Geant4 CXX Flags are a string with quotes, not a list, so we need to convert to a list...
+    string(REPLACE " " ";" Geant4_Flags ${Geant4_CXX_FLAGS} ${Geant4_CXX_FLAGS_${CMAKE_BUILD_TYPE}})
+    SET(Geant4_CXX_FLAGS ${Geant4_Flags})
+
+    #Geant4_DEFINITIONS already include -D, we jave to get rid of that so we can join things when creating dictionaries
+    SET(G4_DEF_TEMP "")
+    foreach(def ${Geant4_DEFINITIONS})
+      string(REPLACE "-D" "" def ${def})
+      LIST(APPEND G4_DEF_TEMP ${def})
+    endforeach()
+    SET(Geant4_DEFINITIONS ${G4_DEF_TEMP})
+    UNSET(G4_DEF_TEMP)
+
+    #get_filename_component(Geant4_LOCATION ${Geant4_INCLUDE_DIRS} DIRECTORY)
+    #SET(Geant4_LOCATION "/cvmfs/ilc.desy.de/sw/x86_64_gcc49_sl6/geant4/10.03.p02/lib64")
+
+    ADD_LIBRARY(Geant4::Interface INTERFACE IMPORTED GLOBAL)
+
+    SET_TARGET_PROPERTIES(Geant4::Interface
+      PROPERTIES
+      INTERFACE_COMPILE_OPTIONS "${Geant4_CXX_FLAGS}"
+      INTERFACE_COMPILE_DEFINITIONS "${Geant4_DEFINITIONS}"
+      INTERFACE_INCLUDE_DIRECTORIES "${Geant4_INCLUDE_DIRS}"
+      )
+
+    IF(CLHEP)
+      MESSAGE(STATUS "Adding CLHEP to Geant4::Interface Dependencies")
+      TARGET_LINK_LIBRARIES(Geant4::Interface INTERFACE ${CLHEP})
+    ENDIF()
+
+    #Geant4_LIBRARIES are imported targets, we just add them all to our own interface library for convenience
+    #Geant4 Libraries to not (yet) use a namespace
+    foreach(LIB ${Geant4_LIBRARIES})
+      #ADD_LIBRARY(Geant4::${LIB} SHARED IMPORTED GLOBAL)
+      # MESSAGE(STATUS "Geant4 lib location ${LIB} ${G4_LIB_TEMP_${LIB}}")
+      # SET_TARGET_PROPERTIES(Geant4::${LIB}
+      #   PROPERTIES
+      #   INTERFACE_COMPILE_OPTIONS "${Geant4_CXX_FLAGS}"
+      #   INTERFACE_COMPILE_DEFINITIONS "${Geant4_DEFINITIONS}"
+      #   INTERFACE_INCLUDE_DIRECTORIES "${Geant4_INCLUDE_DIRS}"
+      #   IMPORTED_LOCATION ${G4_LIB_TEMP_${LIB}}
+      #   )
+      TARGET_LINK_LIBRARIES(Geant4::Interface INTERFACE ${LIB})
+    endforeach()
+
+    MESSAGE(STATUS "Geant4 Libraries ${Geant4_LIBRARIES};${Geant4_COMPONENT_LIBRARIES}")
+    MESSAGE(STATUS "Geant4 Location ${Geant4_LOCATION}")
+    MESSAGE(STATUS "Geant4 Defintitions ${Geant4_DEFINITIONS}")
+    MESSAGE(STATUS "Geant4 CXX_FLAGS ${Geant4_CXX_FLAGS}")
+    MESSAGE(STATUS "Geant4 INCL DIRS ${Geant4_INCLUDE_DIRS}")
+    MESSAGE(STATUS "Geant4_VERSION: ${Geant4_VERSION}" )
+
+  ENDIF()
+ENDMACRO()
\ No newline at end of file
diff --git a/examples/AlignDet/CMakeLists.txt b/examples/AlignDet/CMakeLists.txt
index 4886c38d811bfc084cc8c717830eb0fe96e42856..ea7d7bdde785712e9223530c60e257accd96dee0 100644
--- a/examples/AlignDet/CMakeLists.txt
+++ b/examples/AlignDet/CMakeLists.txt
@@ -13,16 +13,23 @@ include ( ${DD4hep_DIR}/cmake/DD4hep.cmake )
 
 #--------------------------------------------------------------------------
 dd4hep_configure_output()
-dd4hep_package ( AlignDet MAJOR 0 MINOR 0 PATCH 1
-  USES           [ROOT   REQUIRED COMPONENTS Geom GenVector MathCore] 
-                 [DD4hep REQUIRED COMPONENTS DDCore DDCond DDAlign]
-  OPTIONAL       XERCESC
-  INCLUDE_DIRS   include
+# dd4hep_package ( AlignDet MAJOR 0 MINOR 0 PATCH 1
+#   USES           [ROOT   REQUIRED COMPONENTS Geom GenVector MathCore] 
+#                  [DD4hep REQUIRED COMPONENTS DDCore DDCond DDAlign]
+#   OPTIONAL       XERCESC
+#   INCLUDE_DIRS   include
+#   )
+
+link_libraries(ROOT::Core ROOT::Geom ROOT::GenVector ROOT::MathCore
+  DD4hep::DDCore
+  DD4hep::DDCond
+  DD4hep::DDAlign
   )
 set(AlignDet_INSTALL ${CMAKE_INSTALL_PREFIX}/examples/AlignDet)
-dd4hep_add_plugin(   AlignDetExample SOURCES src/*.cpp  )
-dd4hep_install_dir(  compact DESTINATION ${AlignDet_INSTALL} )
-dd4hep_configure_scripts( AlignDet DEFAULT_SETUP WITH_TESTS)
+new_dd4hep_add_plugin(AlignDetExample SOURCES src/*.cpp)
+dd4hep_install_dir(compact DESTINATION ${AlignDet_INSTALL})
+dd4hep_configure_scripts(AlignDet DEFAULT_SETUP WITH_TESTS)
+install(TARGETS AlignDetExample LIBRARY DESTINATION lib)
 
 #
 #---Testing: Load Telescope geometry and read conditions ------------------
diff --git a/examples/CLICSiD/CMakeLists.txt b/examples/CLICSiD/CMakeLists.txt
index 76d38ea9c1b89637fea5986512f8d1fa92e5fede..977a3ed4fd40a6ef535a26ab816994eec66bc16c 100644
--- a/examples/CLICSiD/CMakeLists.txt
+++ b/examples/CLICSiD/CMakeLists.txt
@@ -13,23 +13,30 @@ include ( ${DD4hep_DIR}/cmake/DD4hep.cmake )
 
 #-----------------------------------------------------------------------------------
 dd4hep_configure_output ()
-dd4hep_package ( CLICSiD MAJOR 0 MINOR 0 PATCH 1
-  USES  [ROOT   REQUIRED COMPONENTS Geom] 
-        [DD4hep REQUIRED COMPONENTS DDCore]
-)
+
+find_package(DD4hep)
+find_package(ROOT REQUIRED COMPONENTS Geom)
+
 set(CLICSiDEx_INSTALL         ${CMAKE_INSTALL_PREFIX}/examples/CLICSiD)
 dd4hep_install_dir( scripts sim DESTINATION ${CLICSiDEx_INSTALL} )
 #--------------------------------------------------------------------------
 if (DD4HEP_USE_GEANT4)
-  find_package(Geant4 REQUIRED)
-  dd4hep_add_executable(CLICSiDXML SOURCES scripts/CLICSiDXML.C
-    USES [DD4hep REQUIRED COMPONENTS DDCore DDG4] Geant4)
-  #--------------------------------------------------------------------------
-  dd4hep_add_executable(CLICSiDAClick SOURCES scripts/CLICSiDAClick.C
-    USES [DD4hep REQUIRED COMPONENTS DDCore DDG4] Geant4)
+  add_executable(CLICSiDXML scripts/CLICSiDXML.C)
+  target_link_libraries(CLICSiDXML DD4hep::DDCore DD4hep::DDG4)
+  
+  add_executable(CLICSiDAClick  scripts/CLICSiDAClick.C)
+  target_link_libraries(CLICSiDAClick DD4hep::DDCore DD4hep::DDG4)
 endif()
 #
+
+install(TARGETS CLICSiDXML CLICSiDAClick DESTINATION bin)
+
 dd4hep_configure_scripts ( CLICSiD DEFAULT_SETUP WITH_TESTS )
+
+enable_testing ()
+include(CTest)
+
+
 #
 #---Testing-------------------------------------------------------------------------
 #
diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt
index aec4b03aee28c6851ae04fe6b2538c8b28a8a184..23dac178c30f676c9ebd295474c61332a58e2483 100644
--- a/examples/CMakeLists.txt
+++ b/examples/CMakeLists.txt
@@ -28,7 +28,9 @@ endif ()
 
 project( DD4hep_Examples )
 
+include(CTest)
 option(BUILD_TESTING "Enable and build tests" ON)
+
 option(CMAKE_MACOSX_RPATH "Build with rpath on macos" ON)
 #
 find_package ( DD4hep REQUIRED )
@@ -36,50 +38,44 @@ include ( ${DD4hep_DIR}/cmake/DD4hep.cmake )
 include ( ${DD4hep_DIR}/cmake/DD4hepBuild.cmake )
 #
 find_package ( ROOT REQUIRED COMPONENTS Geom GenVector )
-include(${ROOT_USE_FILE})
+#include(${ROOT_USE_FILE})
 #
 dd4hep_set_compiler_flags()
 SET( ENV{DD4hepExamplesINSTALL} ${CMAKE_INSTALL_PREFIX} )
 #
 dd4hep_configure_output()
-dd4hep_package ( dd4hepExample MAJOR 0 MINOR 15 PATCH 0 
-  USES           [ROOT REQUIRED COMPONENTS Geom GenVector] 
-                 [dd4hep REQUIRED COMPONENTS DDCore]
-)
-#
-dd4hep_enable_tests (
-  CLICSiD
-  LHeD
-  AlignDet
-  ClientTests
-  Conditions
-  DDG4
-  DDDigi
-  Persistency
-  SimpleDetector
-  DDG4_MySensDet
-  DDCodex
-  )
-if ( "${ROOT_VERSION}" VERSION_GREATER_EQUAL "6.18.00" )
-  dd4hep_enable_tests (
-    OpticalSurfaces
-    )
-endif()
-#
-# XercesC dependent stuff
-if ( DD4HEP_USE_XERCESC )
-  dd4hep_print("|++> XercesC PRESENT. Building DDDB examples.")
-  dd4hep_enable_tests (DDDB)
-else()
-  dd4hep_print("|++> XercesC is not present. NOT building DDDB examples.")
-endif()
-#
-# CLHEP dependent stuff:
-find_package (CLHEP QUIET)
-string(FIND "${CLHEP_DIR}" "NOTFOUND" HaveDDCMS)
-if ( NOT ${HaveDDCMS} GREATER 0 )
-  dd4hep_print("|++> XercesC PRESENT. Building DDCMS examples.")
-  dd4hep_enable_tests (DDCMS)
-else()
-  dd4hep_print("|++> CLHEP is not present. NOT building DDCMS examples.")
-endif()
+
+find_package(ROOT REQUIRED COMPONENTS Geom GenVector)
+
+add_subdirectory(CLICSiD)
+add_subdirectory(LHeD)
+add_subdirectory(AlignDet)
+add_subdirectory(ClientTests)
+add_subdirectory(Conditions)
+# add_subdirectory(DDG4)
+# add_subdirectory(DDDigi)
+# #add_subdirectory(OpticalSurfaces) ## needs root version >= 6.18
+# add_subdirectory(Persistency)
+# add_subdirectory(SimpleDetector)
+# add_subdirectory(DDG4_MySensDet)
+# add_subdirectory(DDCodex)
+
+
+# # XercesC dependent stuff
+# if(DD4HEP_USE_XERCESC)
+#   dd4hep_print("|++> XercesC PRESENT. Building DDDB examples.")
+#   add_subdirectory(DDDB)
+# else()
+#   dd4hep_print("|++> XercesC is not present. NOT building DDDB examples.")
+# endif()
+
+# # CLHEP dependent stuff:
+# find_package (CLHEP QUIET)
+# string(FIND "${CLHEP_DIR}" "NOTFOUND" HaveDDCMS)
+# if (TARGET CLHEP::CLHEP)
+#   dd4hep_print("|++> CLHEP PRESENT. Building DDCMS examples.")
+#   add_subdirectory(DDCMS)
+# else()
+#   dd4hep_print("|++> CLHEP is not present. NOT building DDCMS examples.")
+# endif()
+>>>>>>> Modifications in examples
diff --git a/examples/ClientTests/CMakeLists.txt b/examples/ClientTests/CMakeLists.txt
index 88888daaeb4623e3dbbe21a5cf2d57dc0b234fbc..812d7e08615eadb8b9ce9d914f21779cdad4058b 100644
--- a/examples/ClientTests/CMakeLists.txt
+++ b/examples/ClientTests/CMakeLists.txt
@@ -13,18 +13,29 @@ 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
-  OPTIONAL       [BOOST SOURCES src_boost/*.cpp]
+
+if(TARGET XercesC::XercesC)
+  link_libraries(XercesC::XercesC)
+endif()
+
+link_libraries(ROOT::Core ROOT::Geom ROOT::GenVector
+  DD4hep::DDCore
+  DD4hep::DDCond
+  DD4hep::DDAlign
   )
+include_directories(./include)
+#--------------------------------------------------------------------------
+if(TARGET Boost::boost)
+  SET(CT_BOOST_SOURCES src_boost/*.cpp)
+  set(CT_BOOST_LIB Boost::boost)
+endif()
+new_dd4hep_add_plugin(ClientTests SOURCES src/*.cpp ${CT_BOOST_SOURCES}) 
+target_link_libraries(ClientTests ${CT_BOOST_LIB})
+install(TARGETS ClientTests LIBRARY DESTINATION lib)
+
 #
 #-----------------------------------------------------------------------------------
-dd4hep_add_executable( multipleGeo   main/MultipleGeometries.cpp )
+add_executable( multipleGeo   main/MultipleGeometries.cpp )
 #-----------------------------------------------------------------------------------
 #
 #
diff --git a/examples/Conditions/CMakeLists.txt b/examples/Conditions/CMakeLists.txt
index 532eaf685aa59f7537e4512e94bb8a3c72dcdda0..0286f5b7b27f5fa26f997ca9cfb6cf0e71dd7651 100644
--- a/examples/Conditions/CMakeLists.txt
+++ b/examples/Conditions/CMakeLists.txt
@@ -13,13 +13,25 @@ include ( ${DD4hep_DIR}/cmake/DD4hep.cmake )
 
 #--------------------------------------------------------------------------
 dd4hep_configure_output ()
-dd4hep_package ( Conditions MAJOR 0 MINOR 0 PATCH 1
-  USES         [ROOT   REQUIRED COMPONENTS Geom GenVector]
-               [DD4hep REQUIRED COMPONENTS DDCore DDCond DDAlign]
-  OPTIONAL     XERCESC
-)
+
+if(TARGET XercesC::XercesC)
+  link_libraries(XercesC::XercesC)
+endif()
+
+link_libraries(ROOT::Core ROOT::Geom ROOT::GenVector
+  DD4hep::DDCore
+  DD4hep::DDCond
+  DD4hep::DDAlign
+  )
+  
+# dd4hep_package ( Conditions MAJOR 0 MINOR 0 PATCH 1
+#   USES         [ROOT   REQUIRED COMPONENTS Geom GenVector]
+#                [DD4hep REQUIRED COMPONENTS DDCore DDCond DDAlign]
+#   OPTIONAL     XERCESC
+# )
 #-----------------------------------------------------------------------------------
-dd4hep_add_plugin(ConditionsExample SOURCES src/*.cpp)
+new_dd4hep_add_plugin(ConditionsExample SOURCES src/*.cpp)
+install(TARGETS ConditionsExample LIBRARY DESTINATION lib)
 dd4hep_install_dir( xml  DESTINATION examples/Conditions )
 dd4hep_install_dir( data DESTINATION examples/Conditions )
 dd4hep_configure_scripts ( Conditions DEFAULT_SETUP WITH_TESTS )
diff --git a/examples/LHeD/CMakeLists.txt b/examples/LHeD/CMakeLists.txt
index 4df9f2b05e996b41dd9da7310e01a255a4317257..262ff92a8467196ca38c1439d0165361fd7fb456 100644
--- a/examples/LHeD/CMakeLists.txt
+++ b/examples/LHeD/CMakeLists.txt
@@ -13,25 +13,35 @@ include ( ${DD4hep_DIR}/cmake/DD4hep.cmake )
 
 #-----------------------------------------------------------------------------------
 dd4hep_configure_output ()
-dd4hep_package ( LHeD MAJOR 0 MINOR 0 PATCH 1
-  USES           [ROOT   REQUIRED COMPONENTS Geom GenVector MathCore] 
-                 [DD4hep REQUIRED COMPONENTS DDRec DDCore DDCond DDAlign]
-  )
+# dd4hep_package ( LHeD MAJOR 0 MINOR 0 PATCH 1
+#   USES           [ROOT   REQUIRED COMPONENTS Geom GenVector MathCore] 
+#                  [DD4hep REQUIRED COMPONENTS DDRec DDCore DDCond DDAlign]
+#   )
 set(LHeDEx_INSTALL         ${CMAKE_INSTALL_PREFIX}/examples/LHeD)
 dd4hep_install_dir( src compact scripts sim DESTINATION ${LHeDEx_INSTALL} )
 #-----------------------------------------------------------------------------------
 set(LIBRARY_OUTPUT_PATH    ${PROJECT_BINARY_DIR}/lib)
 set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
-dd4hep_add_plugin(LHeD SOURCES src/*.cpp)
+
+new_dd4hep_add_plugin(LHeD SOURCES src/*.cpp
+  LINK_LIBRARIES ROOT::Core ROOT::Geom ROOT::GenVector
+  DD4hep::DDRec DD4hep::DDCore DD4hep::DDCond DD4hep::DDAlign
+  )
 
 if (DD4HEP_USE_GEANT4)
   find_package(Geant4 REQUIRED)
-  dd4hep_add_executable(LHeDXML SOURCES scripts/LHeDXML.C
-    USES [DD4hep REQUIRED COMPONENTS DDCore DDG4] Geant4)
+  add_executable(LHeDXML scripts/LHeDXML.C)
+  target_link_libraries(LHeDXML DD4hep::DDCore DD4hep::DDG4 Geant4::Interface)
   #--------------------------------------------------------------------------
-  dd4hep_add_executable(LHeDACLick SOURCES scripts/LHeDACLick.C
-    USES [DD4hep REQUIRED COMPONENTS DDCore DDG4] Geant4)
+  add_executable(LHeDACLick scripts/LHeDACLick.C)
+  target_link_libraries(LHeDACLick DD4hep::DDCore DD4hep::DDG4 Geant4::Interface)
 endif()
+
+
+INSTALL(TARGETS LHeDXML LHeDACLick  LHeD
+  RUNTIME DESTINATION bin
+  LIBRARY DESTINATION lib
+  )
 #
 dd4hep_configure_scripts(LHeD DEFAULT_SETUP WITH_TESTS)
 #