From 8e9f5d11b164af9defc71a3010637d1926ef4018 Mon Sep 17 00:00:00 2001 From: jmcarcell Date: Fri, 15 Sep 2023 10:36:26 +0200 Subject: [PATCH] Check if the CLHEP target exists before creating it --- cmake/DD4hepBuild.cmake | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cmake/DD4hepBuild.cmake b/cmake/DD4hepBuild.cmake index ab12d75a7..add54c83a 100644 --- a/cmake/DD4hepBuild.cmake +++ b/cmake/DD4hepBuild.cmake @@ -826,7 +826,9 @@ MACRO(DD4HEP_SETUP_GEANT4_TARGETS) if(Geant4_builtin_clhep_FOUND) dd4hep_debug("Using Geant4 internal CLHEP") - ADD_LIBRARY(CLHEP::CLHEP INTERFACE IMPORTED GLOBAL) + IF(NOT TARGET CLHEP::CLHEP) + ADD_LIBRARY(CLHEP::CLHEP INTERFACE IMPORTED GLOBAL) + ENDIF() SET_TARGET_PROPERTIES(CLHEP::CLHEP PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${Geant4_INCLUDE_DIRS}"