From f06631dd34554b68f90fc7294bc089884ae908f0 Mon Sep 17 00:00:00 2001
From: Andre Sailer <andre.philippe.sailer@cern.ch>
Date: Thu, 15 Feb 2024 13:33:33 +0100
Subject: [PATCH] CMake: use the LCIO::lcio target instead of LCIO::LCIO

LCIO now exports LCIO::lcio, so we could use that if LCIO is new enough
---
 DDEve/CMakeLists.txt       | 4 ++--
 DDG4/CMakeLists.txt        | 4 ++--
 UtilityApps/CMakeLists.txt | 6 +++---
 cmake/DD4hepBuild.cmake    | 6 +++---
 4 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/DDEve/CMakeLists.txt b/DDEve/CMakeLists.txt
index 7b27cecc8..ab7029438 100644
--- a/DDEve/CMakeLists.txt
+++ b/DDEve/CMakeLists.txt
@@ -40,9 +40,9 @@ if(TARGET ROOT::ROOTEve)
   SET(DDEVE_ROOT7_LINK ROOT::ROOTEve)
 endif()
 
-if(TARGET LCIO::LCIO)
+if(TARGET LCIO::lcio)
   SET(DDEVE_LCIO_SOURCES lcio/LCIOEventHandler.cpp)
-  SET(DDEVE_LCIO_LINK LCIO::LCIO)
+  SET(DDEVE_LCIO_LINK LCIO::lcio)
 endif()
 
 dd4hep_add_plugin(DDEvePlugins SOURCES src/*.cpp ${DDEVE_LCIO_SOURCES} ${DDEVE_ROOT7_SOURCES}
diff --git a/DDG4/CMakeLists.txt b/DDG4/CMakeLists.txt
index 09ca5de6f..4813dd28e 100644
--- a/DDG4/CMakeLists.txt
+++ b/DDG4/CMakeLists.txt
@@ -92,10 +92,10 @@ endif()
 
 #---------------------------  Plugin library for the simulation framework  ---------
 #---------------------------  LCIO Plugins for new simulation framework  -----------
-IF(TARGET LCIO::LCIO)
+IF(TARGET LCIO::lcio)
   dd4hep_add_plugin(DDG4LCIO
     SOURCES lcio/*.cpp
-    USES    DD4hep::DDG4 LCIO::LCIO
+    USES    DD4hep::DDG4 LCIO::lcio
     )
   install(TARGETS DDG4LCIO EXPORT DD4hep LIBRARY DESTINATION lib)
   set_target_properties(DDG4LCIO PROPERTIES VERSION ${DD4hep_VERSION} SOVERSION ${DD4hep_SOVERSION})
diff --git a/UtilityApps/CMakeLists.txt b/UtilityApps/CMakeLists.txt
index ed19ef4e3..1f57c447a 100644
--- a/UtilityApps/CMakeLists.txt
+++ b/UtilityApps/CMakeLists.txt
@@ -52,10 +52,10 @@ endif()
 if(BUILD_TESTING)
   if(DD4HEP_USE_LCIO)
     add_executable(test_surfaces src/test_surfaces.cpp)
-    target_link_libraries(test_surfaces DD4hep::DDRec DD4hep::DDTest LCIO::LCIO)
+    target_link_libraries(test_surfaces DD4hep::DDRec DD4hep::DDTest LCIO::lcio)
 
     add_executable(test_cellid_position_converter src/test_cellid_position_converter.cpp)
-    target_link_libraries(test_cellid_position_converter DD4hep::DDRec DD4hep::DDTest LCIO::LCIO)
+    target_link_libraries(test_cellid_position_converter DD4hep::DDRec DD4hep::DDTest LCIO::lcio)
 
     LIST(APPEND OPTIONAL_EXECUTABLES test_surfaces)
     LIST(APPEND OPTIONAL_EXECUTABLES test_cellid_position_converter)
@@ -76,7 +76,7 @@ if (DD4HEP_USE_LCIO)
     USES    DD4hep::DDCore ROOT::Geom
     )
   add_executable(teveLCIO G__eve1.cxx src/teve_display.cpp src/next_event_lcio.cpp)
-  target_link_libraries(teveLCIO DD4hep::DDRec LCIO::LCIO ROOT::Core ROOT::Eve ROOT::Gui ROOT::Graf3d ROOT::RGL)
+  target_link_libraries(teveLCIO DD4hep::DDRec LCIO::lcio ROOT::Core ROOT::Eve ROOT::Gui ROOT::Graf3d ROOT::RGL)
   LIST(APPEND OPTIONAL_EXECUTABLES teveLCIO)
 endif()
 
diff --git a/cmake/DD4hepBuild.cmake b/cmake/DD4hepBuild.cmake
index bcd3407f7..ef84a22d0 100644
--- a/cmake/DD4hepBuild.cmake
+++ b/cmake/DD4hepBuild.cmake
@@ -901,9 +901,9 @@ ENDMACRO()
 # Create Interface library for LCIO
 #
 MACRO(DD4HEP_SETUP_LCIO_TARGETS)
-  IF(NOT TARGET LCIO::LCIO)
-    ADD_LIBRARY(LCIO::LCIO INTERFACE IMPORTED GLOBAL)
-    SET_TARGET_PROPERTIES(LCIO::LCIO
+  IF(NOT TARGET LCIO::lcio)
+    ADD_LIBRARY(LCIO::lcio INTERFACE IMPORTED GLOBAL)
+    SET_TARGET_PROPERTIES(LCIO::lcio
       PROPERTIES
       INTERFACE_INCLUDE_DIRECTORIES "${LCIO_INCLUDE_DIRS}"
       INTERFACE_LINK_LIBRARIES "${LCIO_LIBRARIES}"
-- 
GitLab