Skip to content

Commit

Permalink
Check if the CLHEP target exists before creating it, if it does warn
Browse files Browse the repository at this point in the history
  • Loading branch information
jmcarcell committed Sep 15, 2023
1 parent 094aa6c commit 4871333
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion cmake/DD4hepBuild.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -826,7 +826,11 @@ MACRO(DD4HEP_SETUP_GEANT4_TARGETS)

if(Geant4_builtin_clhep_FOUND)
dd4hep_debug("Using Geant4 internal CLHEP")
ADD_LIBRARY(CLHEP::CLHEP INTERFACE IMPORTED GLOBAL)
if(TARGET CLHEP::CLHEP)
message(WARNING "CLHEP::CLHEP already exists, this may cause problems if there are two different installations of CLHEP, one from Geant4 and one external")
else()
ADD_LIBRARY(CLHEP::CLHEP INTERFACE IMPORTED GLOBAL)
endif()
SET_TARGET_PROPERTIES(CLHEP::CLHEP
PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${Geant4_INCLUDE_DIRS}"
Expand Down

0 comments on commit 4871333

Please sign in to comment.