Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Workaround missing G4persistency target bug in Geant4 11.2 #1122

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 21 additions & 5 deletions cmake/CeleritasUtils.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -644,14 +644,30 @@ function(celeritas_get_g4libs var)
set(_ext "-static")
endif()

foreach(_lib IN LISTS ARGN)
set(_lib Geant4::G4${_lib}${_ext})
if(NOT TARGET "${_lib}")
message(AUTHOR_WARNING "No Geant4 library '${_lib}' exists")
else()
foreach(_shortlib IN LISTS ARGN)
set(_lib Geant4::G4${_shortlib}${_ext})
if(TARGET "${_lib}")
list(APPEND _result "${_lib}")
elseif(_shortlib STREQUAL "persistency")
# Workaround for differing target names in 11.2.0,1 for G4persistency
# We do this here and not in FindGeant4 because we have no
# guarantee projects using Celeritas and Geant4 won't mess with target
# names themselves (and if we had to create a "celeritas::" target,
# we'd still have to specialize here).
list(APPEND _result Geant4::G4mctruth${_ext} Geant4::G4geomtext${_ext})
if(TARGET "Geant4::G4gdml${_ext}")
list(APPEND _result Geant4::G4gdml${_ext})
endif()
elseif(_shortlib STREQUAL "tasking")
# Same workaround for tasking, which was split between G4global and G4run
# from 11.1
list(APPEND _result Geant4::G4run${_ext} Geant4::G4global${_ext})
else()
message(AUTHOR_WARNING "No Geant4 library '${_lib}' exists")
endif()
endforeach()
# This avoids "ld: warning: ignoring duplicate libraries:"
list(REMOVE_DUPLICATES _result)
endif()
set(${var} "${_result}" PARENT_SCOPE)
endfunction()
Expand Down
Loading