Skip to content
Failed

Console Output

Skipping 1,566 KB.. Full Log
  device code.

    ::

      celeritas_target_link_libraries(<target>
        <PRIVATE|PUBLIC|INTERFACE> <item>...
        [<PRIVATE|PUBLIC|INTERFACE> <item>...]...))

  Usage requirements from linked library targets will be propagated to all four targets. Usage requirements
  of a target's dependencies affect compilation of its own sources. In the case that ``<target>`` does
  not contain CUDA code, the command decays to ``target_link_libraries``.

  See ``target_link_libraries`` for additional detail.


.. command:: celeritas_target_include_directories

  Add include directories to a target.

    ::

      celeritas_target_include_directories(<target> [SYSTEM] [AFTER|BEFORE]
        <INTERFACE|PUBLIC|PRIVATE> [items1...]
        [<INTERFACE|PUBLIC|PRIVATE> [items2...] ...])

  Specifies include directories to use when compiling a given target. The named <target>
  must have been created by a command such as celeritas_rdc_add_library(), add_executable() or add_library(),
  and can be used with an ALIAS target. It is aware of the 4 underlying targets (objects, static,
  middle, final) present when the input target was created celeritas_rdc_add_library() and will propagate
  the include directories to all four. In the case that ``<target>`` does not contain CUDA code,
  the command decays to ``target_include_directories``.

  See ``target_include_directories`` for additional detail.


.. command:: celeritas_install

  Specify installation rules for a CUDA RDC target.

    ::
      celeritas_install(TARGETS targets... <ARGN>)

  In the case that an input target does not contain CUDA code, the command decays
  to ``install``.

  See ``install`` for additional detail.

.. command:: celeritas_target_compile_options

   Specify compile options for a CUDA RDC target

     ::
       celeritas_target_compile_options(<target> [BEFORE]
         <INTERFACE|PUBLIC|PRIVATE> [items1...]
         [<INTERFACE|PUBLIC|PRIVATE> [items2...] ...])

  In the case that an input target does not contain CUDA code, the command decays
  to ``target_compile_options``.

  See ``target_compile_options`` for additional detail.

#]=======================================================================]

include_guard(GLOBAL)

#-----------------------------------------------------------------------------#

define_property(TARGET PROPERTY CELERITAS_CUDA_LIBRARY_TYPE
  BRIEF_DOCS "Indicate the type of cuda library (STATIC and SHARED for nvlink usage, FINAL for linking into not cuda library/executable"
  FULL_DOCS "Indicate the type of cuda library (STATIC and SHARED for nvlink usage, FINAL for linking into not cuda library/executable"
)
define_property(TARGET PROPERTY CELERITAS_CUDA_FINAL_LIBRARY
  BRIEF_DOCS "Name of the final library corresponding to this cuda library"
  FULL_DOCS "Name of the final library corresponding to this cuda library"
)
define_property(TARGET PROPERTY CELERITAS_CUDA_STATIC_LIBRARY
  BRIEF_DOCS "Name of the static library corresponding to this cuda library"
  FULL_DOCS "Name of the static library corresponding to this cuda library"
)
define_property(TARGET PROPERTY CELERITAS_CUDA_MIDDLE_LIBRARY
  BRIEF_DOCS "Name of the shared (without nvlink step) library corresponding to this cuda library"
  FULL_DOCS "Name of the shared (without nvlink step) library corresponding to this cuda library"
)
define_property(TARGET PROPERTY CELERITAS_CUDA_OBJECT_LIBRARY
  BRIEF_DOCS "Name of the object (without nvlink step) library corresponding to this cuda library"
  FULL_DOCS "Name of the object (without nvlink step) library corresponding to this cuda library"
)

##############################################################################
# Separate the OPTIONS out from the sources
#
macro(cuda_get_sources_and_options _sources _cmake_options _options)
  set( ${_sources} )
  set( ${_cmake_options} )
  set( ${_options} )
  set( _found_options FALSE )
  foreach(arg ${ARGN})
    if(arg STREQUAL "OPTIONS")
      set( _found_options TRUE )
    elseif(
        arg STREQUAL "WIN32" OR
        arg STREQUAL "MACOSX_BUNDLE" OR
        arg STREQUAL "EXCLUDE_FROM_ALL" OR
        arg STREQUAL "STATIC" OR
        arg STREQUAL "SHARED" OR
        arg STREQUAL "MODULE"
        )
      list(APPEND ${_cmake_options} ${arg})
    else()
      if( _found_options )
        list(APPEND ${_options} ${arg})
      else()
        # Assume this is a file
        list(APPEND ${_sources} ${arg})
      endif()
    endif()
  endforeach()
endmacro()

#-----------------------------------------------------------------------------#
#
# Internal routine to figure out if a list contains
# CUDA source code.  Returns empty or the list of CUDA files in the var
#
function(celeritas_sources_contains_cuda var)
  set(_result)
  foreach(_source ${ARGN})
    get_source_file_property(_iscudafile "${_source}" LANGUAGE)
    if(_iscudafile STREQUAL "CUDA")
      list(APPEND _result "${_source}")
    elseif(NOT _iscudafile)
      get_filename_component(_ext "${_source}" LAST_EXT)
      if(_ext STREQUAL ".cu")
        list(APPEND _result "${_source}")
      endif()
    endif()
  endforeach()
  set(${var} "${_result}" PARENT_SCOPE)
endfunction()

#-----------------------------------------------------------------------------#
#
# Internal routine to figure out if a target already contains
# CUDA source code.  Returns empty or list of CUDA files in the OUTPUT_VARIABLE
#
function(celeritas_lib_contains_cuda OUTPUT_VARIABLE target)
  celeritas_strip_alias(target ${target})

  get_target_property(_targettype ${target} CELERITAS_CUDA_LIBRARY_TYPE)
  if(_targettype)
    # The target is one of the components of a library with CUDA separatable code,
    # no need to check the source files.
    set(${OUTPUT_VARIABLE} TRUE PARENT_SCOPE)
  else()
    get_target_property(_target_sources ${target} SOURCES)
    celeritas_sources_contains_cuda(_contains_cuda ${_target_sources})
    set(${OUTPUT_VARIABLE} ${_contains_cuda} PARENT_SCOPE)
  endif()
endfunction()

#-----------------------------------------------------------------------------#
#
# Generate an empty .cu file to transform the library to a CUDA library
#
function(celeritas_generate_empty_cu_file emptyfilenamevar target)
  set(_stub "${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${target}_emptyfile.cu")
  if(NOT EXISTS ${_stub})
    file(WRITE "${_stub}" "/* intentionally empty. */")
  endif()
  set(${emptyfilenamevar} ${_stub} PARENT_SCOPE)
endfunction()

#-----------------------------------------------------------------------------#
#
# Transfer the setting \${what} (both the PUBLIC and INTERFACE version) to from library \${fromlib} to the library \${tolib} that depends on it
#
function(celeritas_transfer_setting fromlib tolib what)
  get_target_property(_temp ${fromlib} ${what})
  if(_temp)
    cmake_language(CALL target_${what} ${tolib} PUBLIC ${_temp})
  endif()
  get_target_property(_temp ${fromlib} INTERFACE_${what})
  if(_temp)
    cmake_language(CALL target_${what} ${tolib} PUBLIC ${_temp})
  endif()
endfunction()

#-----------------------------------------------------------------------------#
# celeritas_rdc_add_library
#
# Add a library taking into account whether it contains
# or depends on separatable CUDA code.  If it contains
# cuda code, it will be marked as "separatable compilation"
# (i.e. request "Relocatable device code")
#
function(celeritas_rdc_add_library target)

  cuda_get_sources_and_options(_sources _cmake_options _options ${ARGN})

  celeritas_sources_contains_cuda(_cuda_sources ${_sources})

  if(CELERITAS_USE_HIP AND _cuda_sources)
    # When building Celeritas libraries, we put HIP/CUDA files in shared .cu
    # suffixed files. Override the language if using HIP.
    set_source_files_properties(
      ${_cuda_sources}
      PROPERTIES LANGUAGE HIP
    )
  endif()

  # Whether we need the special code or not is actually dependent on information
  # we don't have ... yet
  # - whether the user request CUDA_SEPARABLE_COMPILATION
  # - whether the library depends on a library with CUDA_SEPARABLE_COMPILATION code.
  # I.e. this should really be done at generation time.
  # So in the meantime we use rely on the user to call this routine
  # only in the case where they want the CUDA device code to be compiled
  # as "relocatable device code"

  if(NOT CELERITAS_USE_VecGeom OR NOT CMAKE_CUDA_COMPILER OR NOT _cuda_sources)
    add_library(${target} ${ARGN})
    return()
  endif()

  cmake_parse_arguments(_ADDLIB_PARSE
    "STATIC;SHARED;MODULE;OBJECT"
    ""
    ""
    ${ARGN}
  )
  set(_lib_requested_type "SHARED")
  set(_cudaruntime_requested_type "Shared")
  set(_staticsuf "_static")
  if((NOT BUILD_SHARED_LIBS AND NOT _ADDLIB_PARSE_SHARED AND NOT _ADDLIB_PARSE_MODULE)
      OR _ADDLIB_PARSE_STATIC)
    set(_lib_requested_type "STATIC")
    set(_cudaruntime_requested_type "Static")
    set(_staticsuf "")
  endif()
  if(_ADDLIB_PARSE_MODULE)
    add_library(${target} ${ARGN})
    set_target_properties(${target} PROPERTIES
      CUDA_SEPARABLE_COMPILATION ON
      CUDA_RUNTIME_LIBRARY ${_cudaruntime_requested_type}
    )
    return()
  endif()
  if(_ADDLIB_PARSE_OBJECT)
    message(FATAL_ERROR "celeritas_rdc_add_library does not support OBJECT library")
  endif()

  ## OBJECTS ##

  add_library(${target}_objects OBJECT ${_ADDLIB_PARSE_UNPARSED_ARGUMENTS})
  set(_object_props
    CUDA_SEPARABLE_COMPILATION ON
    CUDA_RUNTIME_LIBRARY ${_cudaruntime_requested_type}
  )
  if(_lib_requested_type STREQUAL "SHARED")
    list(APPEND _object_props
      POSITION_INDEPENDENT_CODE ON
    )
  endif()
  set_target_properties(${target}_objects PROPERTIES ${_object_props})

  ## MIDDLE (main library) ##

  add_library(${target} ${_lib_requested_type}
    $<TARGET_OBJECTS:${target}_objects>
  )
  set(_common_props
    ${_object_props}
    LINKER_LANGUAGE CUDA
    CELERITAS_CUDA_FINAL_LIBRARY Celeritas::${target}_final
    CELERITAS_CUDA_MIDDLE_LIBRARY Celeritas::${target}
    CELERITAS_CUDA_STATIC_LIBRARY Celeritas::${target}${_staticsuf}
    CELERITAS_CUDA_OBJECT_LIBRARY ${target}_objects
  )
  set_target_properties(${target} PROPERTIES
    ${_common_props}
    CELERITAS_CUDA_LIBRARY_TYPE Shared
    CUDA_RESOLVE_DEVICE_SYMBOLS OFF # We really don't want nvlink called.
    EXPORT_PROPERTIES "CELERITAS_CUDA_LIBRARY_TYPE;CELERITAS_CUDA_FINAL_LIBRARY;CELERITAS_CUDA_MIDDLE_LIBRARY;CELERITAS_CUDA_STATIC_LIBRARY"
  )

  ## STATIC ##

  if(_staticsuf)
    add_library(${target}${_staticsuf} STATIC
      $<TARGET_OBJECTS:${target}_objects>
    )
    add_library(Celeritas::${target}${_staticsuf} ALIAS ${target}${_staticsuf})
    set_target_properties(${target}${_staticsuf} PROPERTIES
      ${_common_props}
      CELERITAS_CUDA_LIBRARY_TYPE Static
      EXPORT_PROPERTIES "CELERITAS_CUDA_LIBRARY_TYPE;CELERITAS_CUDA_FINAL_LIBRARY;CELERITAS_CUDA_MIDDLE_LIBRARY;CELERITAS_CUDA_STATIC_LIBRARY"
    )
  endif()

  ## FINAL (dlink) ##

  # We need to use a dummy file as a library (per cmake) needs to contains
  # at least one source file.  The real content of the library will be
  # the cmake_device_link.o resulting from the execution of `nvcc -dlink`
  # Also non-cuda related test, for example `gtest_detail_Macros`,
  # will need to be linked again libceleritas_final while a library
  # that the depends on and that uses Celeritas::Core (for example
  # libCeleritasTest.so) will need to be linked against `libceleritas`.
  # If both the middle and `_final` contains the `.o` files we would
  # then have duplicated symbols .  If both the middle and `_final`
  # library contained the result of `nvcc -dlink` then we would get
  # conflicting but duplicated *weak* symbols and here the symptoms
  # will be a crash during the cuda library initialization or a failure to
  # launch some kernels rather than a link error.
  celeritas_generate_empty_cu_file(_emptyfilename ${target})
  add_library(${target}_final ${_lib_requested_type} ${_emptyfilename})
  add_library(Celeritas::${target}_final ALIAS ${target}_final)
  set_target_properties(${target}_final PROPERTIES
    ${_common_props}
    LINK_DEPENDS $<TARGET_FILE:${target}${_staticsuf}>
    CELERITAS_CUDA_LIBRARY_TYPE Final
    CUDA_RESOLVE_DEVICE_SYMBOLS ON
    EXPORT_PROPERTIES "CELERITAS_CUDA_LIBRARY_TYPE;CELERITAS_CUDA_FINAL_LIBRARY;CELERITAS_CUDA_MIDDLE_LIBRARY;CELERITAS_CUDA_STATIC_LIBRARY"
  )
  target_link_libraries(${target}_final PUBLIC ${target} PRIVATE CUDA::toolkit)
  target_link_options(${target}_final
    PRIVATE $<DEVICE_LINK:$<TARGET_FILE:${target}${_staticsuf}>>
  )
  add_dependencies(${target}_final ${target}${_staticsuf})
endfunction()

# Replacement for target_include_directories that is aware of
# the 4 libraries (objects, static, middle, final) libraries needed
# for a separatable CUDA library
function(celeritas_target_include_directories target)
  if(NOT CMAKE_CUDA_COMPILER)
    target_include_directories(${ARGV})
    return()
  endif()

  celeritas_strip_alias(target ${target})
  celeritas_lib_contains_cuda(_contains_cuda ${target})

  if(_contains_cuda)
    get_target_property(_targettype ${target} CELERITAS_CUDA_LIBRARY_TYPE)
    if(_targettype)
      get_target_property(_target_middle ${target} CELERITAS_CUDA_MIDDLE_LIBRARY)
      get_target_property(_target_object ${target} CELERITAS_CUDA_OBJECT_LIBRARY)
    endif()
  endif()
  if(_target_object)
    target_include_directories(${_target_object} ${ARGN})
  endif()
  if(_target_middle)
    celeritas_strip_alias(_target_middle ${_target_middle})
    target_include_directories(${_target_middle} ${ARGN})
  else()
    target_include_directories(${ARGV})
  endif()
endfunction()

#-----------------------------------------------------------------------------#
# Replacement for target_compile_options that is aware of
# the 4 libraries (objects, static, middle, final) libraries needed
# for a separatable CUDA library
function(celeritas_target_compile_options target)
  if(NOT CELERITAS_USE_CUDA)
    target_compile_options(${ARGV})
    return()
  endif()

  celeritas_strip_alias(target ${target})
  celeritas_lib_contains_cuda(_contains_cuda ${target})

  if(_contains_cuda)
    get_target_property(_targettype ${target} CELERITAS_CUDA_LIBRARY_TYPE)
    if(_targettype)
      get_target_property(_target_middle ${target} CELERITAS_CUDA_MIDDLE_LIBRARY)
      get_target_property(_target_object ${target} CELERITAS_CUDA_OBJECT_LIBRARY)
    endif()
  endif()
  if(_target_object)
    target_compile_options(${_target_object} ${ARGN})
  endif()
  if(_target_middle)
    celeritas_strip_alias(_target_middle ${_target_middle})
    target_compile_options(${_target_middle} ${ARGN})
  else()
    target_compile_options(${ARGV})
  endif()
endfunction()

#-----------------------------------------------------------------------------#
#
# Replacement for the install function that is aware of the 3 libraries
# (static, middle, final) libraries needed for a separatable CUDA library
#
function(celeritas_install subcommand firstarg)
  if(NOT subcommand STREQUAL "TARGETS" OR NOT TARGET ${firstarg})
    install(${ARGV})
    return()
  endif()
  set(_targets ${firstarg})
  list(POP_FRONT ARGN _next)
  while(TARGET ${_next})
    list(APPEND _targets ${_next})
    list(POP_FRONT ${ARGN} _next)
  endwhile()
  # At this point all targets are in ${_targets} and ${_next} is the first non target and ${ARGN} is the rest.
  foreach(_toinstall ${_targets})
    celeritas_strip_alias(_prop_target ${_toinstall})
    get_target_property(_lib_target_type ${_prop_target} TYPE)
    if(NOT _lib_target_type STREQUAL "INTERFACE_LIBRARY")
      get_target_property(_targettype ${_prop_target} CELERITAS_CUDA_LIBRARY_TYPE)
      if(_targettype)
        get_target_property(_target_final ${_prop_target} CELERITAS_CUDA_FINAL_LIBRARY)
        get_target_property(_target_middle ${_prop_target} CELERITAS_CUDA_MIDDLE_LIBRARY)
        get_target_property(_target_static ${_prop_target} CELERITAS_CUDA_STATIC_LIBRARY)
        set(_toinstall ${_target_final} ${_target_middle} ${_target_static})
        if(NOT _target_middle STREQUAL _target_static)
          # Avoid duplicate middle/static library for static builds
          list(APPEND _toinstall ${_target_middle})
        endif()
      endif()
    endif()
    install(TARGETS ${_toinstall} ${_next} ${ARGN})
  endforeach()
endfunction()

#-----------------------------------------------------------------------------#
# Return TRUE if 'lib' depends/uses directly or indirectly the library `potentialdepend`
function(celeritas_depends_on OUTVARNAME lib potentialdepend)
  set(${OUTVARNAME} FALSE PARENT_SCOPE)
  if(TARGET ${lib} AND TARGET ${potentialdepend})
    set(lib_link_libraries "")
    get_target_property(_lib_target_type ${lib} TYPE)
    if(NOT _lib_target_type STREQUAL "INTERFACE_LIBRARY")
      get_target_property(lib_link_libraries ${lib} LINK_LIBRARIES)
    endif()
    foreach(linklib ${lib_link_libraries})
      if(linklib STREQUAL potentialdepend)
        set(${OUTVARNAME} TRUE PARENT_SCOPE)
        return()
      endif()
      celeritas_depends_on(${OUTVARNAME} ${linklib} ${potentialdepend})
      if(${OUTVARNAME})
        set(${OUTVARNAME} ${${OUTVARNAME}} PARENT_SCOPE)
        return()
      endif()
    endforeach()
  endif()
endfunction()

#-----------------------------------------------------------------------------#
# Return the 'real' target name whether the output is an alias or not.
function(celeritas_strip_alias OUTVAR target)
  if(TARGET ${target})
    get_target_property(_target_alias ${target} ALIASED_TARGET)
  endif()
  if(TARGET ${_target_alias})
    set(target ${_target_alias})
  endif()
  set(${OUTVAR} ${target} PARENT_SCOPE)
endfunction()

#-----------------------------------------------------------------------------#
# Return the middle/shared library of the target, if any.
macro(celeritas_get_library_middle_target outvar target)
  get_target_property(_target_type ${target} TYPE)
  if(NOT _target_type STREQUAL "INTERFACE_LIBRARY")
    get_target_property(${outvar} ${target} CELERITAS_CUDA_MIDDLE_LIBRARY)
  else()
    set(${outvar} ${target})
  endif()
endmacro()

#-----------------------------------------------------------------------------#
# Retrieve the "middle" library, i.e. given a target, the
# target name to be used as input to the linker of dependent libraries.
function(celeritas_use_middle_lib_in_property target property)
  get_target_property(_target_libs ${target} ${property})

  set(_new_values)
  foreach(_lib ${_target_libs})
    set(_newlib ${_lib})
    if(TARGET ${_lib})
      celeritas_strip_alias(_lib ${_lib})
      celeritas_get_library_middle_target(_libmid ${_lib})
      if(_libmid)
        set(_newlib ${_libmid})
      endif()
    endif()
    list(APPEND _new_values ${_newlib})
  endforeach()

  if(_new_values)
    set_target_properties(${target} PROPERTIES
      ${property} "${_new_values}"
    )
  endif()
endfunction()

#-----------------------------------------------------------------------------#
# Return the most derived "separatable cuda" library the target depends on.
# If two or more cuda library are independent, we return both and the calling executable
# should be linked with nvcc -dlink.
function(celeritas_find_final_library OUTLIST flat_dependency_list)
  set(_result "")
  foreach(_lib ${flat_dependency_list})
    if(NOT _result)
      list(APPEND _result ${_lib})
    else()
      set(_newresult "")
      foreach(_reslib ${_result})
        celeritas_depends_on(_depends_on ${_lib} ${_reslib})
        celeritas_depends_on(_depends_on ${_reslib} ${_lib})

        celeritas_depends_on(_depends_on ${_reslib} ${_lib})
        if(${_depends_on})
          # The library in the result depends/uses the library we are looking at,
          # let's keep the ones from result
          set(_newresult ${_result})
          break()
          # list(APPEND _newresult ${_reslib})
        else()
          celeritas_depends_on(_depends_on ${_lib} ${_reslib})
          if(${_depends_on})
            # We are in the opposite case, let's keep the library we are looking at
            list(APPEND _newresult ${_lib})
          else()
            # Unrelated keep both
            list(APPEND _newresult ${_reslib})
            list(APPEND _newresult ${_lib})
          endif()
        endif()
      endforeach()
      set(_result ${_newresult})
    endif()
  endforeach()
  list(REMOVE_DUPLICATES _result)
  set(_final_result "")
  foreach(_lib ${_result})
    if(TARGET ${_lib})
      get_target_property(_lib_target_type ${_lib} TYPE)
      if(NOT _lib_target_type STREQUAL "INTERFACE_LIBRARY")
        get_target_property(_final_lib ${_lib} CELERITAS_CUDA_FINAL_LIBRARY)
        if(_final_lib)
          list(APPEND _final_result ${_final_lib})
        endif()
      endif()
    endif()
  endforeach()
  set(${OUTLIST} ${_final_result} PARENT_SCOPE)
endfunction()

#-----------------------------------------------------------------------------#
#
#  Check which CUDA runtime is needed for a given (dependent) library.
function(celeritas_check_cuda_runtime OUTVAR library)

  get_target_property(_runtime_setting ${library} CUDA_RUNTIME_LIBRARY)
  if(NOT _runtime_setting)
    # We could get more exact information by using:
    #  file(GET_RUNTIME_DEPENDENCIES LIBRARIES ${_lib_loc} UNRESOLVED_DEPENDENCIES_VAR _lib_dependcies)
    # but we get
    #   You have used file(GET_RUNTIME_DEPENDENCIES) in project mode.  This is
    #     probably not what you intended to do.
    # On the other hand, if the library is using (relocatable) CUDA code and
    # the shared run-time library and we don't have the scafolding libraries
    # (shared/static/final) then this won't work well. i.e. if we were to detect this
    # case we probably need to 'error out'.
    get_target_property(_cuda_library_type ${library} CELERITAS_CUDA_LIBRARY_TYPE)
    get_target_property(_cuda_find_library ${library} CELERITAS_CUDA_FINAL_LIBRARY)
    if(_cuda_library_type STREQUAL "Shared")
      set_target_properties(${library} PROPERTIES CUDA_RUNTIME_LIBRARY "Shared")
      set(_runtime_setting "Shared")
    elseif(NOT _cuda_find_library)
      set_target_properties(${library} PROPERTIES CUDA_RUNTIME_LIBRARY "None")
      set(_runtime_setting "None")
    else()
      # If we have a final library then the library is shared.
      set_target_properties(${library} PROPERTIES CUDA_RUNTIME_LIBRARY "Shared")
      set(_runtime_setting "Shared")
    endif()
  endif()

  set(${OUTVAR} ${_runtime_setting} PARENT_SCOPE)
endfunction()


#-----------------------------------------------------------------------------#
# Replacement for target_link_libraries that is aware of
# the 3 libraries (static, middle, final) libraries needed
# for a separatable CUDA library
function(celeritas_target_link_libraries target)
  if(NOT CMAKE_CUDA_COMPILER)
    target_link_libraries(${ARGV})
    return()
  endif()

  celeritas_strip_alias(target ${target})

  celeritas_lib_contains_cuda(_contains_cuda ${target})

  set(_target_final ${target})
  set(_target_middle ${target})
  if(_contains_cuda)
    get_target_property(_targettype ${target} CELERITAS_CUDA_LIBRARY_TYPE)
    if(_targettype)
      get_target_property(_target_final ${target} CELERITAS_CUDA_FINAL_LIBRARY)
      get_target_property(_target_middle ${target} CELERITAS_CUDA_MIDDLE_LIBRARY)
      get_target_property(_target_object ${target} CELERITAS_CUDA_OBJECT_LIBRARY)
    endif()
  endif()

  # Set now to let target_link_libraries do the argument parsing
  celeritas_strip_alias(_target_middle ${_target_middle})
  target_link_libraries(${_target_middle} ${ARGN})

  celeritas_use_middle_lib_in_property(${_target_middle} INTERFACE_LINK_LIBRARIES)
  celeritas_use_middle_lib_in_property(${_target_middle} LINK_LIBRARIES)

  if(_target_object)
    target_link_libraries(${_target_object} ${ARGN})
    celeritas_use_middle_lib_in_property(${_target_object} INTERFACE_LINK_LIBRARIES)
    celeritas_use_middle_lib_in_property(${_target_object} LINK_LIBRARIES)
  endif()

  celeritas_cuda_gather_dependencies(_alldependencies ${target})
  celeritas_find_final_library(_finallibs "${_alldependencies}")

  get_target_property(_target_type ${target} TYPE)
  if(_target_type STREQUAL "EXECUTABLE"
     OR _target_type STREQUAL "MODULE_LIBRARY")
    list(LENGTH _finallibs _final_count)
    if(_contains_cuda)
      if(${_final_count} GREATER 0)
        # If there is at least one final library this means that we
        # have somewhere some "separable" nvcc compilations
        set_target_properties(${target} PROPERTIES
          CUDA_SEPARABLE_COMPILATION ON
        )
      endif()
    elseif(${_final_count} EQUAL 1)
      set_target_properties(${target} PROPERTIES
        # If cmake detects that a library depends/uses a static library
        # linked with CUDA, it will turn CUDA_RESOLVE_DEVICE_SYMBOLS ON
        # leading to a call to nvlink.  If we let this through (at least
        # in case of Celeritas) we would need to add the DEVICE_LINK options
        # also on non cuda libraries (that we detect depends on a cuda library).
        # Note: we might be able to move this to celeritas_target_link_libraries
        CUDA_RESOLVE_DEVICE_SYMBOLS OFF
      )
      get_target_property(_final_target_type ${target} TYPE)

      get_target_property(_final_runtime ${_finallibs} CUDA_RUNTIME_LIBRARY)
      if(_final_runtime STREQUAL "Shared")
        set_target_properties(${target} PROPERTIES CUDA_RUNTIME_LIBRARY "Shared")
      endif()

      if(_final_target_type STREQUAL "STATIC_LIBRARY")
        # for static libraries we need to list the libraries a second time (to resolve symbol from the final library)
        get_target_property(_current_link_libraries ${target} LINK_LIBRARIES)
        set_property(TARGET ${target} PROPERTY LINK_LIBRARIES ${_current_link_libraries} ${_finallibs} ${_current_link_libraries} )
      else()
        # We could have used:
        #    target_link_libraries(${target} PUBLIC ${_finallibs})
        # but target_link_libraries must used either all plain arguments or all plain
        # keywords and at the moment I don't know how to detect which of the 2 style the
        # user used.
        # Maybe we could use:
        #     if(ARGV1 MATCHES "^(PRIVATE|PUBLIC|INTERFACE)$")
        # or simply keep the following:
        get_target_property(_current_link_libraries ${target} LINK_LIBRARIES)
        set_property(TARGET ${target} PROPERTY LINK_LIBRARIES ${_current_link_libraries} ${_finallibs} )
      endif()
    elseif(${_final_count} GREATER 1)
      # turn into CUDA executable.
      set(_contains_cuda TRUE)
      celeritas_generate_empty_cu_file(_emptyfilename ${target})
      target_sources(${target} PRIVATE ${_emptyfilename})
    endif()
    # nothing to do if there is no final library (i.e. no use of CUDA at all?)
  endif()

  if(_contains_cuda)
    set(_need_to_use_shared_runtime FALSE)
    get_target_property(_current_runtime_setting ${target} CUDA_RUNTIME_LIBRARY)
    if(_current_runtime_setting)
       set(_target_runtime_setting ${_current_runtime_setting})
    endif()
    celeritas_cuda_gather_dependencies(_flat_target_link_libraries ${_target_middle})
    foreach(_lib ${_flat_target_link_libraries})
      get_target_property(_lib_target_type ${_lib} TYPE)
      if(NOT _lib_target_type STREQUAL "INTERFACE_LIBRARY")
        celeritas_check_cuda_runtime(_lib_runtime_setting ${_lib})
        if(NOT _need_to_use_shared_runtime AND _lib_runtime_setting STREQUAL "Shared")
          set(_need_to_use_shared_runtime TRUE)
        endif()
        if(NOT _target_runtime_setting)
          if(_lib_runtime_setting)
            set(_target_runtime_setting ${_lib_runtime_setting})
          endif()
        else()
          if(_lib_runtime_setting AND NOT (_target_runtime_setting STREQUAL _lib_runtime_setting))
            # We need to match the dependent library since we can not change it.
            set(_target_runtime_setting ${_lib_runtime_setting})
          endif()
        endif()
        if(NOT _current_runtime_setting)
          set_target_properties(${target} PROPERTIES CUDA_RUNTIME_LIBRARY ${_target_runtime_setting})
        endif()
        get_target_property(_libstatic ${_lib} CELERITAS_CUDA_STATIC_LIBRARY)
        if(TARGET ${_libstatic})
          celeritas_strip_alias(_target_final ${_target_final})
          target_link_options(${_target_final}
            PRIVATE
            $<DEVICE_LINK:$<TARGET_FILE:${_libstatic}>>
          )
          set_property(TARGET ${_target_final} APPEND
            PROPERTY LINK_DEPENDS $<TARGET_FILE:${_libstatic}>
          )

          # Also pass on the the options and definitions.
          celeritas_transfer_setting(${_libstatic} ${_target_final} COMPILE_OPTIONS)
          celeritas_transfer_setting(${_libstatic} ${_target_final} COMPILE_DEFINITIONS)
          celeritas_transfer_setting(${_libstatic} ${_target_final} LINK_OPTIONS)

          add_dependencies(${_target_final} ${_libstatic})
        endif()
      endif()
    endforeach()


    if(_need_to_use_shared_runtime)
      get_target_property(_current_runtime ${target} CUDA_RUNTIME_LIBRARY)
      if(NOT _current_runtime STREQUAL "Shared")
        set_target_properties(${_target_middle} PROPERTIES CUDA_RUNTIME_LIBRARY "Shared")
        set_target_properties(${_target_final} PROPERTIES CUDA_RUNTIME_LIBRARY "Shared")
        set_target_properties(${_target_object} PROPERTIES CUDA_RUNTIME_LIBRARY "Shared")
      endif()
    endif()
  else() # We could restrict to the case where the dependent is a static library ... maybe
    set_target_properties(${target} PROPERTIES
      # If cmake detects that a library depends/uses a static library
      # linked with CUDA, it will turn CUDA_RESOLVE_DEVICE_SYMBOLS ON
      # leading to a call to nvlink.  If we let this through (at least
      # in case of Celeritas) we would need to add the DEVICE_LINK options
      # also on non cuda libraries (that we detect depends on a cuda library).
      # Note: we might be able to move this to celeritas_target_link_libraries
      CUDA_RESOLVE_DEVICE_SYMBOLS OFF
    )
    if(NOT _target_type STREQUAL "EXECUTABLE")
      get_target_property(_current_runtime ${target} CUDA_RUNTIME_LIBRARY)
      if(NOT _current_runtime STREQUAL "Shared")
        set(_need_to_use_shared_runtime FALSE)
        foreach(_lib ${_alldependencies})
          celeritas_check_cuda_runtime(_runtime ${_lib})
          if(_runtime STREQUAL "Shared")
            set(_need_to_use_shared_runtime TRUE)
            break()
          endif()
        endforeach()
        # We do not yet treat the case where the dependent library is Static
        # and the current one is Shared.
        if(${_need_to_use_shared_runtime})
          set_target_properties(${target} PROPERTIES CUDA_RUNTIME_LIBRARY "Shared")
        endif()
      endif()
    endif()
  endif()

endfunction()

#-----------------------------------------------------------------------------#
#
# Return a flat list of all the direct and indirect dependencies of 'target'
# which are libraries containing CUDA separatable code.
#
function(celeritas_cuda_gather_dependencies outlist target)
  if(NOT TARGET ${target})
    return()
  endif()
  celeritas_strip_alias(target ${target})
  get_target_property(_target_type ${target} TYPE)
  if(NOT _target_type STREQUAL "INTERFACE_LIBRARY")
    get_target_property(_target_link_libraries ${target} LINK_LIBRARIES)
    if(_target_link_libraries)
      foreach(_lib ${_target_link_libraries})
        celeritas_strip_alias(_lib ${_lib})
        if(TARGET ${_lib})
          celeritas_get_library_middle_target(_libmid ${_lib})
        endif()
        if(TARGET ${_libmid})
          list(APPEND ${outlist} ${_libmid})
        endif()
        # and recurse
        celeritas_cuda_gather_dependencies(_midlist ${_lib})
        list(APPEND ${outlist} ${_midlist})
      endforeach()
    endif()
  endif()
  list(REMOVE_DUPLICATES ${outlist})
  set(${outlist} ${${outlist}} PARENT_SCOPE)
endfunction()

#-----------------------------------------------------------------------------#
********** CeleritasTargets.cmake ***********
# Generated by CMake

if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" LESS 2.8)
   message(FATAL_ERROR "CMake >= 2.8.0 required")
endif()
if(CMAKE_VERSION VERSION_LESS "2.8.3")
   message(FATAL_ERROR "CMake >= 2.8.3 required")
endif()
cmake_policy(PUSH)
cmake_policy(VERSION 2.8.3...3.22)
#----------------------------------------------------------------
# Generated CMake target import file.
#----------------------------------------------------------------

# Commands may need to know the format version.
set(CMAKE_IMPORT_FILE_VERSION 1)

# Protect against multiple inclusion, which would fail when already imported targets are added once more.
set(_cmake_targets_defined "")
set(_cmake_targets_not_defined "")
set(_cmake_expected_targets "")
foreach(_cmake_expected_target IN ITEMS Celeritas::celeritas_device_toolkit Celeritas::corecel Celeritas::orange Celeritas::celeritas_geant4 Celeritas::celeritas_hepmc Celeritas::celeritas Celeritas::accel Celeritas::testcel_harness Celeritas::testcel_core Celeritas::testcel_orange Celeritas::testcel_celeritas_core Celeritas::testcel_celeritas_geo Celeritas::testcel_celeritas Celeritas::testcel_accel Celeritas::orange-update Celeritas::celer-export-geant Celeritas::celer-dump-data Celeritas::celer-sim Celeritas::celer-g4 Celeritas::celeritas_demo_interactor)
  list(APPEND _cmake_expected_targets "${_cmake_expected_target}")
  if(TARGET "${_cmake_expected_target}")
    list(APPEND _cmake_targets_defined "${_cmake_expected_target}")
  else()
    list(APPEND _cmake_targets_not_defined "${_cmake_expected_target}")
  endif()
endforeach()
unset(_cmake_expected_target)
if(_cmake_targets_defined STREQUAL _cmake_expected_targets)
  unset(_cmake_targets_defined)
  unset(_cmake_targets_not_defined)
  unset(_cmake_expected_targets)
  unset(CMAKE_IMPORT_FILE_VERSION)
  cmake_policy(POP)
  return()
endif()
if(NOT _cmake_targets_defined STREQUAL "")
  string(REPLACE ";" ", " _cmake_targets_defined_text "${_cmake_targets_defined}")
  string(REPLACE ";" ", " _cmake_targets_not_defined_text "${_cmake_targets_not_defined}")
  message(FATAL_ERROR "Some (but not all) targets in this export set were already defined.\nTargets Defined: ${_cmake_targets_defined_text}\nTargets not yet defined: ${_cmake_targets_not_defined_text}\n")
endif()
unset(_cmake_targets_defined)
unset(_cmake_targets_not_defined)
unset(_cmake_expected_targets)


# Compute the installation prefix relative to this file.
get_filename_component(_IMPORT_PREFIX "${CMAKE_CURRENT_LIST_FILE}" PATH)
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
if(_IMPORT_PREFIX STREQUAL "/")
  set(_IMPORT_PREFIX "")
endif()

# Create imported target Celeritas::celeritas_device_toolkit
add_library(Celeritas::celeritas_device_toolkit INTERFACE IMPORTED)

set_target_properties(Celeritas::celeritas_device_toolkit PROPERTIES
  INTERFACE_INCLUDE_DIRECTORIES "/opt/rocm/include"
  INTERFACE_LINK_DIRECTORIES "/opt/rh/devtoolset-7/root/usr/lib/gcc/x86_64-redhat-linux/7;/opt/rh/devtoolset-7/root/usr/lib64;/lib64;/usr/lib64;/lib;/usr/lib;/opt/rocm/lib"
  INTERFACE_LINK_LIBRARIES "amdhip64;stdc++;m;gcc_s;gcc;c;gcc_s;gcc"
  INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "/opt/rocm/include"
)

# Create imported target Celeritas::corecel
add_library(Celeritas::corecel STATIC IMPORTED)

set_target_properties(Celeritas::corecel PROPERTIES
  INTERFACE_COMPILE_FEATURES "cxx_std_17"
  INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include"
  INTERFACE_LINK_LIBRARIES "\$<LINK_ONLY:Celeritas::celeritas_device_toolkit>;\$<LINK_ONLY:nlohmann_json::nlohmann_json>;\$<LINK_ONLY:OpenMP::OpenMP_CXX>"
)

# Create imported target Celeritas::orange
add_library(Celeritas::orange STATIC IMPORTED)

set_target_properties(Celeritas::orange PROPERTIES
  INTERFACE_LINK_LIBRARIES "\$<LINK_ONLY:nlohmann_json::nlohmann_json>;Celeritas::corecel"
)

# Create imported target Celeritas::celeritas_geant4
add_library(Celeritas::celeritas_geant4 INTERFACE IMPORTED)

set_target_properties(Celeritas::celeritas_geant4 PROPERTIES
  INTERFACE_LINK_LIBRARIES "\$<LINK_ONLY:Celeritas::corecel>;\$<LINK_ONLY:XercesC::XercesC>;\$<LINK_ONLY:Geant4::G4Tree>;\$<LINK_ONLY:Geant4::G4FR>;\$<LINK_ONLY:Geant4::G4GMocren>;\$<LINK_ONLY:Geant4::G4visHepRep>;\$<LINK_ONLY:Geant4::G4RayTracer>;\$<LINK_ONLY:Geant4::G4VRML>;\$<LINK_ONLY:Geant4::G4vis_management>;\$<LINK_ONLY:Geant4::G4modeling>;\$<LINK_ONLY:Geant4::G4interfaces>;\$<LINK_ONLY:Geant4::G4persistency>;\$<LINK_ONLY:Geant4::G4analysis>;\$<LINK_ONLY:Geant4::G4error_propagation>;\$<LINK_ONLY:Geant4::G4readout>;\$<LINK_ONLY:Geant4::G4physicslists>;\$<LINK_ONLY:Geant4::G4run>;\$<LINK_ONLY:Geant4::G4event>;\$<LINK_ONLY:Geant4::G4tasking>;\$<LINK_ONLY:Geant4::G4tracking>;\$<LINK_ONLY:Geant4::G4parmodels>;\$<LINK_ONLY:Geant4::G4processes>;\$<LINK_ONLY:Geant4::G4digits_hits>;\$<LINK_ONLY:Geant4::G4track>;\$<LINK_ONLY:Geant4::G4particles>;\$<LINK_ONLY:Geant4::G4geometry>;\$<LINK_ONLY:Geant4::G4materials>;\$<LINK_ONLY:Geant4::G4graphics_reps>;\$<LINK_ONLY:Geant4::G4intercoms>;\$<LINK_ONLY:Geant4::G4global>;\$<LINK_ONLY:Geant4::G4tools>;\$<LINK_ONLY:Geant4::G4ptl>;\$<LINK_ONLY:Geant4::G4UIVisDefinitions>"
)

# Create imported target Celeritas::celeritas_hepmc
add_library(Celeritas::celeritas_hepmc INTERFACE IMPORTED)

set_target_properties(Celeritas::celeritas_hepmc PROPERTIES
  INTERFACE_LINK_LIBRARIES "\$<LINK_ONLY:Celeritas::corecel>;\$<LINK_ONLY:HepMC3::HepMC3>"
)

# Create imported target Celeritas::celeritas
add_library(Celeritas::celeritas STATIC IMPORTED)

set_target_properties(Celeritas::celeritas PROPERTIES
  INTERFACE_LINK_LIBRARIES "\$<LINK_ONLY:Celeritas::celeritas_device_toolkit>;\$<LINK_ONLY:Celeritas::celeritas_geant4>;\$<LINK_ONLY:Celeritas::celeritas_hepmc>;\$<LINK_ONLY:nlohmann_json::nlohmann_json>;\$<LINK_ONLY:OpenMP::OpenMP_CXX>;Celeritas::corecel;Celeritas::orange"
)

# Create imported target Celeritas::accel
add_library(Celeritas::accel STATIC IMPORTED)

set_target_properties(Celeritas::accel PROPERTIES
  INTERFACE_LINK_LIBRARIES "\$<LINK_ONLY:nlohmann_json::nlohmann_json>;\$<LINK_ONLY:HepMC3::HepMC3>;\$<LINK_ONLY:OpenMP::OpenMP_CXX>;Celeritas::celeritas;Celeritas::corecel;Geant4::G4Tree;Geant4::G4FR;Geant4::G4GMocren;Geant4::G4visHepRep;Geant4::G4RayTracer;Geant4::G4VRML;Geant4::G4vis_management;Geant4::G4modeling;Geant4::G4interfaces;Geant4::G4persistency;Geant4::G4analysis;Geant4::G4error_propagation;Geant4::G4readout;Geant4::G4physicslists;Geant4::G4run;Geant4::G4event;Geant4::G4tasking;Geant4::G4tracking;Geant4::G4parmodels;Geant4::G4processes;Geant4::G4digits_hits;Geant4::G4track;Geant4::G4particles;Geant4::G4geometry;Geant4::G4materials;Geant4::G4graphics_reps;Geant4::G4intercoms;Geant4::G4global;Geant4::G4tools;Geant4::G4ptl;Geant4::G4UIVisDefinitions"
)

# Create imported target Celeritas::testcel_harness
add_library(Celeritas::testcel_harness STATIC IMPORTED)

set_target_properties(Celeritas::testcel_harness PROPERTIES
  INTERFACE_COMPILE_FEATURES "cxx_std_14"
  INTERFACE_LINK_LIBRARIES "Celeritas::corecel;GTest::GTest;\$<LINK_ONLY:nlohmann_json::nlohmann_json>"
)

# Create imported target Celeritas::testcel_core
add_library(Celeritas::testcel_core STATIC IMPORTED)

set_target_properties(Celeritas::testcel_core PROPERTIES
  INTERFACE_LINK_LIBRARIES "\$<LINK_ONLY:Celeritas::testcel_harness>;\$<LINK_ONLY:Celeritas::corecel>"
)

# Create imported target Celeritas::testcel_orange
add_library(Celeritas::testcel_orange STATIC IMPORTED)

set_target_properties(Celeritas::testcel_orange PROPERTIES
  INTERFACE_LINK_LIBRARIES "\$<LINK_ONLY:Celeritas::testcel_harness>;\$<LINK_ONLY:Celeritas::testcel_core>;\$<LINK_ONLY:Celeritas::orange>"
)

# Create imported target Celeritas::testcel_celeritas_core
add_library(Celeritas::testcel_celeritas_core INTERFACE IMPORTED)

set_target_properties(Celeritas::testcel_celeritas_core PROPERTIES
  INTERFACE_LINK_LIBRARIES "\$<LINK_ONLY:Celeritas::testcel_core>;\$<LINK_ONLY:Celeritas::testcel_harness>;\$<LINK_ONLY:Celeritas::celeritas>;\$<LINK_ONLY:nlohmann_json::nlohmann_json>"
)

# Create imported target Celeritas::testcel_celeritas_geo
add_library(Celeritas::testcel_celeritas_geo INTERFACE IMPORTED)

set_target_properties(Celeritas::testcel_celeritas_geo PROPERTIES
  INTERFACE_LINK_LIBRARIES "\$<LINK_ONLY:Celeritas::testcel_harness>;\$<LINK_ONLY:Celeritas::celeritas>;\$<LINK_ONLY:Celeritas::orange>;\$<LINK_ONLY:Geant4::G4Tree>;\$<LINK_ONLY:Geant4::G4FR>;\$<LINK_ONLY:Geant4::G4GMocren>;\$<LINK_ONLY:Geant4::G4visHepRep>;\$<LINK_ONLY:Geant4::G4RayTracer>;\$<LINK_ONLY:Geant4::G4VRML>;\$<LINK_ONLY:Geant4::G4vis_management>;\$<LINK_ONLY:Geant4::G4modeling>;\$<LINK_ONLY:Geant4::G4interfaces>;\$<LINK_ONLY:Geant4::G4persistency>;\$<LINK_ONLY:Geant4::G4analysis>;\$<LINK_ONLY:Geant4::G4error_propagation>;\$<LINK_ONLY:Geant4::G4readout>;\$<LINK_ONLY:Geant4::G4physicslists>;\$<LINK_ONLY:Geant4::G4run>;\$<LINK_ONLY:Geant4::G4event>;\$<LINK_ONLY:Geant4::G4tasking>;\$<LINK_ONLY:Geant4::G4tracking>;\$<LINK_ONLY:Geant4::G4parmodels>;\$<LINK_ONLY:Geant4::G4processes>;\$<LINK_ONLY:Geant4::G4digits_hits>;\$<LINK_ONLY:Geant4::G4track>;\$<LINK_ONLY:Geant4::G4particles>;\$<LINK_ONLY:Geant4::G4geometry>;\$<LINK_ONLY:Geant4::G4materials>;\$<LINK_ONLY:Geant4::G4graphics_reps>;\$<LINK_ONLY:Geant4::G4intercoms>;\$<LINK_ONLY:Geant4::G4global>;\$<LINK_ONLY:Geant4::G4tools>;\$<LINK_ONLY:Geant4::G4ptl>;\$<LINK_ONLY:Geant4::G4UIVisDefinitions>"
)

# Create imported target Celeritas::testcel_celeritas
add_library(Celeritas::testcel_celeritas STATIC IMPORTED)

set_target_properties(Celeritas::testcel_celeritas PROPERTIES
  INTERFACE_LINK_LIBRARIES "\$<LINK_ONLY:Celeritas::testcel_core>;\$<LINK_ONLY:Celeritas::testcel_harness>;\$<LINK_ONLY:Celeritas::celeritas>;\$<LINK_ONLY:nlohmann_json::nlohmann_json>;\$<LINK_ONLY:Celeritas::orange>;\$<LINK_ONLY:Geant4::G4Tree>;\$<LINK_ONLY:Geant4::G4FR>;\$<LINK_ONLY:Geant4::G4GMocren>;\$<LINK_ONLY:Geant4::G4visHepRep>;\$<LINK_ONLY:Geant4::G4RayTracer>;\$<LINK_ONLY:Geant4::G4VRML>;\$<LINK_ONLY:Geant4::G4vis_management>;\$<LINK_ONLY:Geant4::G4modeling>;\$<LINK_ONLY:Geant4::G4interfaces>;\$<LINK_ONLY:Geant4::G4persistency>;\$<LINK_ONLY:Geant4::G4analysis>;\$<LINK_ONLY:Geant4::G4error_propagation>;\$<LINK_ONLY:Geant4::G4readout>;\$<LINK_ONLY:Geant4::G4physicslists>;\$<LINK_ONLY:Geant4::G4run>;\$<LINK_ONLY:Geant4::G4event>;\$<LINK_ONLY:Geant4::G4tasking>;\$<LINK_ONLY:Geant4::G4tracking>;\$<LINK_ONLY:Geant4::G4parmodels>;\$<LINK_ONLY:Geant4::G4processes>;\$<LINK_ONLY:Geant4::G4digits_hits>;\$<LINK_ONLY:Geant4::G4track>;\$<LINK_ONLY:Geant4::G4particles>;\$<LINK_ONLY:Geant4::G4geometry>;\$<LINK_ONLY:Geant4::G4materials>;\$<LINK_ONLY:Geant4::G4graphics_reps>;\$<LINK_ONLY:Geant4::G4intercoms>;\$<LINK_ONLY:Geant4::G4global>;\$<LINK_ONLY:Geant4::G4tools>;\$<LINK_ONLY:Geant4::G4ptl>;\$<LINK_ONLY:Geant4::G4UIVisDefinitions>"
)

# Create imported target Celeritas::testcel_accel
add_library(Celeritas::testcel_accel STATIC IMPORTED)

set_target_properties(Celeritas::testcel_accel PROPERTIES
  INTERFACE_LINK_LIBRARIES "Celeritas::testcel_celeritas;Celeritas::testcel_core;Celeritas::testcel_harness;Celeritas::accel"
)

# Create imported target Celeritas::orange-update
add_executable(Celeritas::orange-update IMPORTED)

# Create imported target Celeritas::celer-export-geant
add_executable(Celeritas::celer-export-geant IMPORTED)

# Create imported target Celeritas::celer-dump-data
add_executable(Celeritas::celer-dump-data IMPORTED)

# Create imported target Celeritas::celer-sim
add_executable(Celeritas::celer-sim IMPORTED)

# Create imported target Celeritas::celer-g4
add_executable(Celeritas::celer-g4 IMPORTED)

# Create imported target Celeritas::celeritas_demo_interactor
add_library(Celeritas::celeritas_demo_interactor STATIC IMPORTED)

set_target_properties(Celeritas::celeritas_demo_interactor PROPERTIES
  INTERFACE_LINK_LIBRARIES "Celeritas::celeritas;nlohmann_json::nlohmann_json"
)

if(CMAKE_VERSION VERSION_LESS 3.0.0)
  message(FATAL_ERROR "This file relies on consumers using CMake 3.0.0 or greater.")
endif()

# Load information for each installed configuration.
file(GLOB _cmake_config_files "${CMAKE_CURRENT_LIST_DIR}/CeleritasTargets-*.cmake")
foreach(_cmake_config_file IN LISTS _cmake_config_files)
  include("${_cmake_config_file}")
endforeach()
unset(_cmake_config_file)
unset(_cmake_config_files)

# Cleanup temporary variables.
set(_IMPORT_PREFIX)

# Loop over all imported files and verify that they actually exist
foreach(_cmake_target IN LISTS _cmake_import_check_targets)
  foreach(_cmake_file IN LISTS "_cmake_import_check_files_for_${_cmake_target}")
    if(NOT EXISTS "${_cmake_file}")
      message(FATAL_ERROR "The imported target \"${_cmake_target}\" references the file
   \"${_cmake_file}\"
but this file does not exist.  Possible reasons include:
* The file was deleted, renamed, or moved to another location.
* An install or uninstall procedure did not complete successfully.
* The installation package was faulty and contained
   \"${CMAKE_CURRENT_LIST_FILE}\"
but not all the files it references.
")
    endif()
  endforeach()
  unset(_cmake_file)
  unset("_cmake_import_check_files_for_${_cmake_target}")
endforeach()
unset(_cmake_target)
unset(_cmake_import_check_targets)

# This file does not depend on other imported targets which have
# been exported from the same project but in a separate export set.

# Commands beyond this point should not need to know the version.
set(CMAKE_IMPORT_FILE_VERSION)
cmake_policy(POP)
********** CeleritasTargets-release.cmake ***********
#----------------------------------------------------------------
# Generated CMake target import file for configuration "Release".
#----------------------------------------------------------------

# Commands may need to know the format version.
set(CMAKE_IMPORT_FILE_VERSION 1)

# Import target "Celeritas::corecel" for configuration "Release"
set_property(TARGET Celeritas::corecel APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
set_target_properties(Celeritas::corecel PROPERTIES
  IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "CXX;HIP"
  IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/lib64/libcorecel.a"
  )

list(APPEND _cmake_import_check_targets Celeritas::corecel )
list(APPEND _cmake_import_check_files_for_Celeritas::corecel "${_IMPORT_PREFIX}/lib64/libcorecel.a" )

# Import target "Celeritas::orange" for configuration "Release"
set_property(TARGET Celeritas::orange APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
set_target_properties(Celeritas::orange PROPERTIES
  IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "CXX"
  IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/lib64/liborange.a"
  )

list(APPEND _cmake_import_check_targets Celeritas::orange )
list(APPEND _cmake_import_check_files_for_Celeritas::orange "${_IMPORT_PREFIX}/lib64/liborange.a" )

# Import target "Celeritas::celeritas" for configuration "Release"
set_property(TARGET Celeritas::celeritas APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
set_target_properties(Celeritas::celeritas PROPERTIES
  IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "CXX;HIP"
  IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/lib64/libceleritas.a"
  )

list(APPEND _cmake_import_check_targets Celeritas::celeritas )
list(APPEND _cmake_import_check_files_for_Celeritas::celeritas "${_IMPORT_PREFIX}/lib64/libceleritas.a" )

# Import target "Celeritas::accel" for configuration "Release"
set_property(TARGET Celeritas::accel APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
set_target_properties(Celeritas::accel PROPERTIES
  IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "CXX;HIP"
  IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/lib64/libaccel.a"
  )

list(APPEND _cmake_import_check_targets Celeritas::accel )
list(APPEND _cmake_import_check_files_for_Celeritas::accel "${_IMPORT_PREFIX}/lib64/libaccel.a" )

# Import target "Celeritas::testcel_harness" for configuration "Release"
set_property(TARGET Celeritas::testcel_harness APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
set_target_properties(Celeritas::testcel_harness PROPERTIES
  IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "CXX"
  IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/lib64/libtestcel_harness.a"
  )

list(APPEND _cmake_import_check_targets Celeritas::testcel_harness )
list(APPEND _cmake_import_check_files_for_Celeritas::testcel_harness "${_IMPORT_PREFIX}/lib64/libtestcel_harness.a" )

# Import target "Celeritas::testcel_core" for configuration "Release"
set_property(TARGET Celeritas::testcel_core APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
set_target_properties(Celeritas::testcel_core PROPERTIES
  IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "CXX"
  IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/lib64/libtestcel_core.a"
  )

list(APPEND _cmake_import_check_targets Celeritas::testcel_core )
list(APPEND _cmake_import_check_files_for_Celeritas::testcel_core "${_IMPORT_PREFIX}/lib64/libtestcel_core.a" )

# Import target "Celeritas::testcel_orange" for configuration "Release"
set_property(TARGET Celeritas::testcel_orange APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
set_target_properties(Celeritas::testcel_orange PROPERTIES
  IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "CXX"
  IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/lib64/libtestcel_orange.a"
  )

list(APPEND _cmake_import_check_targets Celeritas::testcel_orange )
list(APPEND _cmake_import_check_files_for_Celeritas::testcel_orange "${_IMPORT_PREFIX}/lib64/libtestcel_orange.a" )

# Import target "Celeritas::testcel_celeritas" for configuration "Release"
set_property(TARGET Celeritas::testcel_celeritas APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
set_target_properties(Celeritas::testcel_celeritas PROPERTIES
  IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "CXX"
  IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/lib64/libtestcel_celeritas.a"
  )

list(APPEND _cmake_import_check_targets Celeritas::testcel_celeritas )
list(APPEND _cmake_import_check_files_for_Celeritas::testcel_celeritas "${_IMPORT_PREFIX}/lib64/libtestcel_celeritas.a" )

# Import target "Celeritas::testcel_accel" for configuration "Release"
set_property(TARGET Celeritas::testcel_accel APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
set_target_properties(Celeritas::testcel_accel PROPERTIES
  IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "CXX"
  IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/lib64/libtestcel_accel.a"
  )

list(APPEND _cmake_import_check_targets Celeritas::testcel_accel )
list(APPEND _cmake_import_check_files_for_Celeritas::testcel_accel "${_IMPORT_PREFIX}/lib64/libtestcel_accel.a" )

# Import target "Celeritas::orange-update" for configuration "Release"
set_property(TARGET Celeritas::orange-update APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
set_target_properties(Celeritas::orange-update PROPERTIES
  IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/bin/orange-update"
  )

list(APPEND _cmake_import_check_targets Celeritas::orange-update )
list(APPEND _cmake_import_check_files_for_Celeritas::orange-update "${_IMPORT_PREFIX}/bin/orange-update" )

# Import target "Celeritas::celer-export-geant" for configuration "Release"
set_property(TARGET Celeritas::celer-export-geant APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
set_target_properties(Celeritas::celer-export-geant PROPERTIES
  IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/bin/celer-export-geant"
  )

list(APPEND _cmake_import_check_targets Celeritas::celer-export-geant )
list(APPEND _cmake_import_check_files_for_Celeritas::celer-export-geant "${_IMPORT_PREFIX}/bin/celer-export-geant" )

# Import target "Celeritas::celer-dump-data" for configuration "Release"
set_property(TARGET Celeritas::celer-dump-data APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
set_target_properties(Celeritas::celer-dump-data PROPERTIES
  IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/bin/celer-dump-data"
  )

list(APPEND _cmake_import_check_targets Celeritas::celer-dump-data )
list(APPEND _cmake_import_check_files_for_Celeritas::celer-dump-data "${_IMPORT_PREFIX}/bin/celer-dump-data" )

# Import target "Celeritas::celer-sim" for configuration "Release"
set_property(TARGET Celeritas::celer-sim APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
set_target_properties(Celeritas::celer-sim PROPERTIES
  IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/bin/celer-sim"
  )

list(APPEND _cmake_import_check_targets Celeritas::celer-sim )
list(APPEND _cmake_import_check_files_for_Celeritas::celer-sim "${_IMPORT_PREFIX}/bin/celer-sim" )

# Import target "Celeritas::celer-g4" for configuration "Release"
set_property(TARGET Celeritas::celer-g4 APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
set_target_properties(Celeritas::celer-g4 PROPERTIES
  IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/bin/celer-g4"
  )

list(APPEND _cmake_import_check_targets Celeritas::celer-g4 )
list(APPEND _cmake_import_check_files_for_Celeritas::celer-g4 "${_IMPORT_PREFIX}/bin/celer-g4" )

# Import target "Celeritas::celeritas_demo_interactor" for configuration "Release"
set_property(TARGET Celeritas::celeritas_demo_interactor APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
set_target_properties(Celeritas::celeritas_demo_interactor PROPERTIES
  IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "CXX"
  IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/lib64/libceleritas_demo_interactor.a"
  )

list(APPEND _cmake_import_check_targets Celeritas::celeritas_demo_interactor )
list(APPEND _cmake_import_check_files_for_Celeritas::celeritas_demo_interactor "${_IMPORT_PREFIX}/lib64/libceleritas_demo_interactor.a" )

# Commands beyond this point should not need to know the version.
set(CMAKE_IMPORT_FILE_VERSION)
-- The CXX compiler identification is GNU 7.3.1
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /opt/rh/devtoolset-7/root/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
183/196 Test #160: celeritas/random/RngEngine ......................................................   Passed    0.50 sec
        Start 163: celeritas/random/XorwowRngEngine
-- The HIP compiler identification is Clang 15.0.0
-- Detecting HIP compiler ABI info
-- Detecting HIP compiler ABI info - done
-- Check for working HIP compiler: /opt/rocm/llvm/bin/clang++ - skipped
-- Detecting HIP compile features
-- Detecting HIP compile features - done
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
184/196 Test #163: celeritas/random/XorwowRngEngine ................................................   Passed    0.98 sec
        Start 175: celeritas/track/TrackSort
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Check if compiler accepts -pthread
-- Check if compiler accepts -pthread - yes
-- Found Threads: TRUE  
-- Found Celeritas: /var/jenkins/workspace/celeritas_PR-1042/install/lib64/cmake/Celeritas/CeleritasConfig.cmake (found suitable version "0.5.0", minimum required is "0.5") 
-- Configuring done
-- Generating done
-- Build files have been written to: /var/jenkins/workspace/celeritas_PR-1042/example/minimal/build
185/196 Test #175: celeritas/track/TrackSort .......................................................   Passed    1.13 sec
        Start 176: celeritas/track/TrackInit
186/196 Test #193: app/celer-g4:none ...............................................................   Passed   14.36 sec
187/196 Test #192: app/celer-g4:cpu ................................................................   Passed   14.46 sec
[1/2] Building CXX object CMakeFiles/minimal.dir/minimal.cc.o
[2/2] Linking HIP executable minimal
FAILED: minimal 
: && /opt/rocm/llvm/bin/clang++ --offload-arch=gfx908 --offload-arch=gfx908 -Wl,-rpath=/opt/rh/devtoolset-7/root/usr/lib64 -Wl,-rpath=/opt/rh/devtoolset-7/root/usr/lib CMakeFiles/minimal.dir/minimal.cc.o -o minimal -L/opt/rh/devtoolset-7/root/usr/lib -Wl,-rpath,/opt/view/lib64:/opt/software/linux-centos7-x86_64/gcc-7.3.1/xerces-c-3.2.3-gysfmqaecsrbi3n7jm2y6ks433sjyna5/lib:/opt/software/linux-centos7-x86_64/gcc-7.3.1/zlib-1.2.13-ehffwlghderw6l746zya3bawdhcgfnvr/lib:/opt/software/linux-centos7-x86_64/gcc-7.3.1/expat-2.4.8-r4afp64rtmzbxklnlkkjeleaibl665yk/lib:/opt/software/linux-centos7-x86_64/gcc-7.3.1/clhep-2.4.6.0-7kz2najh4o6e5nbrji7wlqj4dlo2nrxy/lib  /var/jenkins/workspace/celeritas_PR-1042/install/lib64/libceleritas.a  /opt/view/lib64/libG4Tree.so  /opt/view/lib64/libG4FR.so  /opt/view/lib64/libG4GMocren.so  /opt/view/lib64/libG4visHepRep.so  /opt/view/lib64/libG4RayTracer.so  /opt/view/lib64/libG4VRML.so  /opt/view/lib64/libG4vis_management.so  /opt/view/lib64/libG4modeling.so  /opt/view/lib64/libG4interfaces.so  /opt/view/lib64/libG4persistency.so  /opt/software/linux-centos7-x86_64/gcc-7.3.1/xerces-c-3.2.3-gysfmqaecsrbi3n7jm2y6ks433sjyna5/lib/libxerces-c.so  /opt/view/lib64/libG4error_propagation.so  /opt/view/lib64/libG4readout.so  /opt/view/lib64/libG4physicslists.so  /opt/view/lib64/libG4tasking.so  /opt/view/lib64/libG4run.so  /opt/view/lib64/libG4event.so  /opt/view/lib64/libG4tracking.so  /opt/view/lib64/libG4parmodels.so  /opt/view/lib64/libG4processes.so  /opt/view/lib64/libG4analysis.so  /opt/software/linux-centos7-x86_64/gcc-7.3.1/zlib-1.2.13-ehffwlghderw6l746zya3bawdhcgfnvr/lib/libz.so  /opt/software/linux-centos7-x86_64/gcc-7.3.1/expat-2.4.8-r4afp64rtmzbxklnlkkjeleaibl665yk/lib/libexpat.so  /opt/view/lib64/libG4digits_hits.so  /opt/view/lib64/libG4track.so  /opt/view/lib64/libG4particles.so  /opt/view/lib64/libG4geometry.so  /opt/view/lib64/libG4materials.so  /opt/view/lib64/libG4graphics_reps.so  /opt/view/lib64/libG4intercoms.so  /opt/view/lib64/libG4global.so  /opt/software/linux-centos7-x86_64/gcc-7.3.1/clhep-2.4.6.0-7kz2najh4o6e5nbrji7wlqj4dlo2nrxy/lib/libCLHEP-2.4.6.0.so  -lstdc++fs  /opt/view/lib64/libG4tools.so  /opt/view/lib64/libG4ptl.so.0.0.2  -pthread  /opt/view/lib64/libHepMC3.so  /var/jenkins/workspace/celeritas_PR-1042/install/lib64/liborange.a  /var/jenkins/workspace/celeritas_PR-1042/install/lib64/libcorecel.a  -lamdhip64  -lstdc++  -lm  -lgcc_s  -lgcc  -lc  -lgcc_s  -lgcc  -lc  -lgomp  -lpthread && :
clang-15: warning: argument unused during compilation: '--offload-arch=gfx908' [-Wunused-command-line-argument]
clang-15: warning: argument unused during compilation: '--offload-arch=gfx908' [-Wunused-command-line-argument]
ld.lld: error: unable to find library -lamdhip64
clang-15: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.
Post stage
[Pipeline] xunit
INFO: Processing CTest-Version 3.x (default)
[Pipeline] }
$ docker stop --time=1 c6d8c2907c7530ec668cb291fb85dfc9be424cfcb96b412c7d98f899e867e12c
INFO: [CTest-Version 3.x (default)] - 1 test report file(s) were found with the pattern 'build/Testing/**/*.xml' relative to '/var/jenkins/workspace/celeritas_PR-1042' for the testing framework 'CTest-Version 3.x (default)'.
188/196 Test #176: celeritas/track/TrackInit .......................................................   Passed    0.59 sec
        Start 177: celeritas/user/DetectorSteps
189/196 Test #177: celeritas/user/DetectorSteps ....................................................   Passed    0.49 sec
        Start 178: celeritas/user/Diagnostic:-TestEm3*
190/196 Test #178: celeritas/user/Diagnostic:-TestEm3* .............................................   Passed    0.48 sec
        Start 179: celeritas/user/Diagnostic:TestEm3*
$ docker rm -f --volumes c6d8c2907c7530ec668cb291fb85dfc9be424cfcb96b412c7d98f899e867e12c
[Pipeline] // withDockerContainer
[Pipeline] }
[Pipeline] // withEnv
[Pipeline] }
191/196 Test #179: celeritas/user/Diagnostic:TestEm3* ..............................................   Passed    0.59 sec
        Start 180: celeritas/user/StepCollector
[Pipeline] // node
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
Failed in branch rocm-ndebug-orange-float
192/196 Test #180: celeritas/user/StepCollector ....................................................   Passed    0.62 sec
        Start 189: app/celer-sim:gpu
193/196 Test #189: app/celer-sim:gpu ...............................................................   Passed    0.86 sec
        Start 191: app/celer-g4:gpu
194/196 Test #191: app/celer-g4:gpu ................................................................   Passed   10.23 sec
        Start 195: app/demo-interactor
195/196 Test #195: app/demo-interactor .............................................................   Passed    0.51 sec
        Start 196: app/demo-geo-check
196/196 Test #196: app/demo-geo-check ..............................................................***Not Run (Disabled)   0.00 sec

100% tests passed, 0 tests failed out of 189

Label Time Summary:
app           =  43.98 sec*proc (10 tests)
gpu           =  31.03 sec*proc (34 tests)
nomemcheck    =  44.06 sec*proc (8 tests)
unit          =  31.48 sec*proc (185 tests)

Total Test time (real) =  29.52 sec

The following tests did not run:
	102 - celeritas/em/UrbanMsc (Disabled)
	111 - celeritas/ext/RootImporter (Disabled)
	148 - celeritas/io/RootEventIO (Disabled)
	159 - celeritas/phys/ProcessBuilder (Disabled)
	187 - app/celer-export-geant (Disabled)
	188 - app/celer-dump-data (Disabled)
	196 - app/demo-geo-check (Disabled)
+ find Testing -name '*.xml'
Testing/20240123-1326/Test.xml
+ cmake --install .
-- Install configuration: "Release"
+ cd ..
+ test -x /var/jenkins/workspace/celeritas_PR-1042/install/bin/celer-sim
+ test -x /var/jenkins/workspace/celeritas_PR-1042/install/bin/celer-g4
+ /var/jenkins/workspace/celeritas_PR-1042/install/bin/celer-sim --version
0.5.0-dev.11+6ae1056f
+ export CMAKE_PRESET
+ export CELER_SOURCE_DIR
+ case "${CMAKE_PRESET}" in
+ exec /var/jenkins/workspace/celeritas_PR-1042/scripts/ci/test-examples.sh
********** CeleritasAddTest.cmake ***********
#----------------------------------*-CMake-*----------------------------------#
# Copyright 2020-2024 UT-Battelle, LLC, and other Celeritas developers.
# See the top-level COPYRIGHT file for details.
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
#[=======================================================================[.rst:

CeleritasAddTest
----------------

Build and add unit tests for Celeritas.

Commands
^^^^^^^^

.. command:: celeritas_setup_tests

  Set dependencies for the python tests in the current CMakeLists file,
  always resetting the num_process and harness options (see the Variables
  section below) but leaving the link/dependency options in place.

    celeritas_setup_tests(
      [LINK_LIBRARIES <target> [<target> ...]]
      [ADD_DEPENDENCIES <target>]
      [PREFIX <package_name>]
      [SERIAL]
      [PYTHON]
      )

    ``LINK_LIBRARIES``
      Link test executables to these library.

    ``ADD_DEPENDENCIES``
      Require the listed depenencies to be built before the tests.

    ``PREFIX``
      Add the given prefix to the constructed test name.

    ``SERIAL``
      Set CELERITASTEST_NP to 1, so that tests are serial by default.

    ``PYTHON``
      Build Python-basted tests.

.. command:: celeritas_add_test

Add a CUDA/HIP/C++ GoogleTest test::

    celeritas_add_test(
      <filename>
      [TIMEOUT seconds]
      [NP n1 [n2 ...]]
      [LINK_LIBRARIES lib1 [lib2 ...]]
      [DEPTEST deptest]
      [SUFFIX text]
      [ADD_DEPENDENCIES target1 [target2 ...]]
      [ARGS arg1 [arg2 ...]]
      [ENVIRONMENT VAR=value [VAR2=value2 ...]]
      [FILTER test1 [test2 ...]]
      [INPUTS file1 [file2 ...]]
      [SOURCES file1 [...]]
      [DISABLE]
      [DRIVER]
      [REUSE_EXE]
      [GPU]
      )

    ``<filename>``
      Test source file name (or python filename).

    ``NP``
      A list of the number of processes to launch via MPI for this unit test.
      The default is to use CELERITASTEST_NP (1, 2, and 4) for MPI builds and 1
      for serial builds.

    ``NT``
      The number of threads to reserve for this test and set
      ``OMP_NUM_THREADS``, ignored if OpenMP is disabled.

    ``LINK_LIBRARIES``
      Extra libraries to link to. By default, unit tests will link against the
      package's current library.

    ``ADD_DEPENDENCIES``
      Extra dependencies for building the execuatable, e.g.  preprocessing data
      or copying files.

    ``DEPTEST``
      The base name of another test in the current CMakeLists file that must be
      run before the current test.

    ``SUFFIX``
      Add this suffix to the target and test name.

    ``ENVRIONMENT``
      Set the given environment variables when the test is run.

    ``FILTER``
      A list of ``--gtest_filter`` arguments that will be iterated over.  This
      allows one large test file to be executed as several independent CTest
      tests.

    ``DISABLE``
      Omit this test from the list of tests to run through CTest, but still
      build it to reduce the chance of code rot.

    ``DRIVER``
      Assume the file acts as a "driver" that launches an underlying
      process in parallel. The CELERITASTEST_NP environment variable is set for
      that test and can be used to determine the number of processors to use.
      The test itself is *not* called with MPI.

    ``REUSE_EXE``
      Assume the executable was already built from a previous celeritas_add_test
      command. This is useful for specifying combinations of NP/FILTER.

    ``GPU``
      Add a resource lock so that only one GPU test will be run at once.

    ``ADDED_TESTS``
      Output variable name for the name or list of names for added tests,
      suitable for ``set_tests_properties``.

Variables
^^^^^^^^^

The following ``CELERITASTEST_<VAR>`` variables set default properties on tests
defined by ``celeritas_add_test``, analogously to how some ``CMAKE_<VAR>``
variables set default values for target property ``<VAR>``:

``CELERITASTEST_NP`` : list
  Default to running parallel tests with these numbers of processes (default:
  ``1;2;4``).

``CELERITASTEST_LINK_LIBRARIES`` : list
  Link these libraries into each tests.

``CELERITASTEST_ADD_DEPENDENCIES`` : list
  Require that these targets be built before the test is built.

``CELERITASTEST_HARNESS`` : string
  One of "none", "gtest", or "python". Defaults to "gtest" (use the Nemesis gtest
  harness and main function); the "python" option uses the exnihilotools unit
  test harness.

``CELERITASTEST_PYTHONPATH`` : list
  Default entries for the PYTHONPATH environment variable. This should have the
  build directories first, then configure-time directories, then user
  directories.

See the `CMake variable documentation`_ for a description of how scoping will
affect variables. For example, these can be set at global or package level and
overridden in each test directory.

.. _CMake variable documentation : https://cmake.org/cmake/help/latest/manual/cmake-language.7.html#cmake-language-variables

#]=======================================================================]

include_guard()

#-----------------------------------------------------------------------------#

set(_procs 1)
if(CELERITAS_USE_MPI)
  list(APPEND _procs 2)
  if(MPIEXEC_MAX_NUMPROCS GREATER 2)
    list(APPEND _procs ${MPIEXEC_MAX_NUMPROCS})
  endif()
endif()
set(CELERITASTEST_NP_DEFAULT "${_procs}" CACHE INTERNAL
  "Default number of processes to use in CeleritasAddTest")
set(_procs)

if(NOT CELERITAS_USE_MPI)
  # Construct test name with MPI enabled, or empty if not applicable
  function(_celeritasaddtest_test_name outvar test_name np suffix)
    set(_name "${test_name}${suffix}")
    if(np GREATER 1)
      set(_name)
    endif()
    set(${outvar} "${_name}" PARENT_SCOPE)
  endfunction()

  # Construct MPI command, or empty if not applicable
  function(_celeritasaddtest_mpi_cmd outvar np test_exe)
    set(_cmd "${test_exe}" ${ARGN})
    set(${outvar} "${_cmd}" PARENT_SCOPE)
  endfunction()
else()
  # Construct test name with MPI enabled but not tribits
  function(_celeritasaddtest_test_name outvar test_name np suffix)
    if(np GREATER CELERITAS_MAX_NUMPROCS)
      set(_name)
    elseif(np GREATER 1)
      set(_name "${test_name}/${np}${suffix}")
    else()
      set(_name "${test_name}${suffix}")
    endif()
    set(${outvar} "${_name}" PARENT_SCOPE)
  endfunction()

  function(_celeritasaddtest_mpi_cmd outvar np test_exe)
    if(np GREATER 1)
      set(_cmd "${MPIEXEC_EXECUTABLE}" ${MPIEXEC_NUMPROC_FLAG} "${np}"
        ${MPIEXEC_PREFLAGS} ${test_exe} ${MPIEXEC_POSTFLAGS} ${ARGN})
    else()
      set(_cmd ${test_exe} ${ARGN})
    endif()
    set(${outvar} "${_cmd}" PARENT_SCOPE)
  endfunction()
endif()

#-----------------------------------------------------------------------------#
# celeritas_setup_tests
#-----------------------------------------------------------------------------#

function(celeritas_setup_tests)
  cmake_parse_arguments(PARSE
    "SERIAL;PYTHON"
    "PREFIX"
    "LINK_LIBRARIES;ADD_DEPENDENCIES"
    ${ARGN}
  )

  # Set special variables
  foreach(_var LINK_LIBRARIES ADD_DEPENDENCIES PREFIX)
    set(CELERITASTEST_${_var} "${PARSE_${_var}}" PARENT_SCOPE)
  endforeach()

  # Override default num procs if requested
  set(CELERITASTEST_NP ${CELERITASTEST_NP_DEFAULT})
  if(PARSE_SERIAL)
    set(CELERITASTEST_NP 1)
  endif()
  set(CELERITASTEST_NP "${CELERITASTEST_NP}" PARENT_SCOPE)

  set(CELERITASTEST_HARNESS "gtest")
  if(PARSE_PYTHON)
    set(CELERITASTEST_HARNESS "python")
  endif()
  set(CELERITASTEST_HARNESS "${CELERITASTEST_HARNESS}" PARENT_SCOPE)
endfunction()

#-----------------------------------------------------------------------------#
# celeritas_add_test
#-----------------------------------------------------------------------------#

function(celeritas_add_test SOURCE_FILE)
  cmake_parse_arguments(PARSE
    "DISABLE;DRIVER;REUSE_EXE;GPU"
    "TIMEOUT;DEPTEST;SUFFIX;ADDED_TESTS;NT"
    "LINK_LIBRARIES;ADD_DEPENDENCIES;NP;ENVIRONMENT;ARGS;INPUTS;FILTER;SOURCES"
    ${ARGN}
  )
  if(PARSE_UNPARSED_ARGUMENTS)
    message(SEND_ERROR "Unknown keywords given to celeritas_add_test(): "
            "\"${PARSE_UNPARSED_ARGUMENTS}\"")
  endif()

  if(NOT CELERITASTEST_HARNESS OR CELERITASTEST_HARNESS STREQUAL "gtest")
    set(_CELERITASTEST_IS_GTEST TRUE)
  elseif(CELERITASTEST_HARNESS STREQUAL "python")
    set(_CELERITASTEST_IS_PYTHON TRUE)
  elseif(SOURCE_FILE MATCHES "\.py$")
    set(_CELERITASTEST_IS_PYTHON TRUE)
  endif()

  if(PARSE_INPUTS)
    message(FATAL_ERROR "INPUTS argument to celeritas_add_test is not implemented")
  endif()

  if(NOT PARSE_NP)
    if(CELERITASTEST_NP)
      set(PARSE_NP ${CELERITASTEST_NP})
    else()
      set(PARSE_NP ${CELERITASTEST_NP_DEFAULT})
    endif()
  endif()

  # Add prefix to test name and possibly dependent name
  get_filename_component(_BASENAME "${SOURCE_FILE}" NAME_WE)
  if(CELERITASTEST_PREFIX)
    set(_TARGET "${CELERITASTEST_PREFIX}/${_BASENAME}")
    string(REGEX REPLACE "[^a-zA-Z0-9_]+" "_" _TARGET "${_TARGET}")
    if(PARSE_DEPTEST)
      set(PARSE_DEPTEST "${CELERITASTEST_PREFIX}/${PARSE_DEPTEST}")
    endif()
    set(_PREFIX "${CELERITASTEST_PREFIX}/")
  endif()
  if(PARSE_SUFFIX)
    set(_TARGET "${_TARGET}_${PARSE_SUFFIX}")
    if(PARSE_DEPTEST)
      set(PARSE_DEPTEST "${PARSE_DEPTEST}/${PARSE_SUFFIX}")
    endif()
    set(_SUFFIX "/${PARSE_SUFFIX}")
  endif()

  if(_CELERITASTEST_IS_PYTHON)
    get_filename_component(SOURCE_FILE "${SOURCE_FILE}" ABSOLUTE)
    set(_EXE_NAME "${PYTHON_EXECUTABLE}")
    set(_EXE_ARGS -W once "${SOURCE_FILE}" -v)
    if(NOT EXISTS "${SOURCE_FILE}")
      message(SEND_ERROR "Python test file '${SOURCE_FILE}' does not exist")
    endif()
    if(PARSE_SOURCES)
      message(FATAL_ERROR "The SOURCE argument cannot be used "
        "with Python tests")
    endif()
  elseif(PARSE_REUSE_EXE)
    set(_EXE_NAME "$<TARGET_FILE:${_TARGET}>")
    if(NOT TARGET "${_TARGET}")
      message(WARNING "Target ${_TARGET} has not yet been created")
    endif()
  else()
    set(_EXE_NAME "$<TARGET_FILE:${_TARGET}>")

    # Create an executable and link libraries against it
    add_executable(${_TARGET} "${SOURCE_FILE}" ${PARSE_SOURCES})

    # Note: for static linking the library order is relevant.

    celeritas_target_link_libraries(${_TARGET}
      ${CELERITASTEST_LINK_LIBRARIES}
      ${PARSE_LINK_LIBRARIES}
      Celeritas::testcel_harness
    )

    if(PARSE_ADD_DEPENDENCIES OR CELERITASTEST_ADD_DEPENDENCIES)
      # Add additional dependencies
      add_dependencies(${_TARGET} ${PARSE_ADD_DEPENDENCIES}
        ${CELERITASTEST_ADD_DEPENDENCIES})
    endif()
  endif()

  # Add standard CELERITAS environment variables
  if(CELERITASTEST_PYTHONPATH)
    list(APPEND PARSE_ENVIRONMENT "PYTHONPATH=${CELERITASTEST_PYTHONPATH}")
  endif()

  if(CELERITAS_TEST_VERBOSE)
    list(APPEND PARSE_ENVIRONMENT
      "CELER_LOG=debug"
      "CELER_LOG_LOCAL=diagnostic"
    )
  else()
    list(APPEND PARSE_ENVIRONMENT
      "CELER_LOG=warning"
      "CELER_LOG_LOCAL=warning"
    )
  endif()

  set(_COMMON_PROPS)
  set(_LABELS)
  if(CELERITAS_USE_CUDA OR CELERITAS_USE_HIP)
    if(NOT PARSE_GPU)
      list(APPEND PARSE_ENVIRONMENT "CELER_DISABLE_DEVICE=1")
    else()
      if(CELERITAS_TEST_RESOURCE_LOCK)
        # Add a "resource lock" when building without debug checking to get more
        # accurate test times (since multiple GPU processes won't be competing for
        # the same card).
        # To speed up overall test time, *do not* apply the resource lock when
        # we're debugging because timings don't matter.
        list(APPEND _COMMON_PROPS RESOURCE_LOCK gpu)
      endif()
      list(APPEND _LABELS gpu)
    endif()
  endif()
  if(PARSE_TIMEOUT)
    list(APPEND _COMMON_PROPS TIMEOUT ${PARSE_TIMEOUT})
  endif()
  if(PARSE_DISABLE)
    list(APPEND _COMMON_PROPS DISABLED TRUE)
  endif()
  if(_CELERITASTEST_IS_GTEST OR _CELERITASTEST_IS_PYTHON)
    list(APPEND _COMMON_PROPS
      PASS_REGULAR_EXPRESSION "tests PASSED"
      FAIL_REGULAR_EXPRESSION "tests FAILED"
    )
  endif()
  if(PARSE_DRIVER)
    list(APPEND _LABELS nomemcheck)
  else()
    list(APPEND _LABELS unit)
  endif()

  if(CELERITAS_USE_MPI AND PARSE_NP STREQUAL "1")
    list(APPEND PARSE_ENVIRONMENT "CELER_DISABLE_PARALLEL=1")
  endif()

  if(CELERITAS_USE_OpenMP)
    if(PARSE_NT)
      list(APPEND PARSE_ENVIRONMENT "OMP_NUM_THREADS=${PARSE_NT}")
    endif()
  else()
    set(PARSE_NT)
  endif()

  if(NOT PARSE_FILTER)
    # Set to a non-empty but false value
    set(PARSE_FILTER "OFF")
  endif()

  foreach(_filter IN LISTS PARSE_FILTER)
    foreach(_np IN LISTS PARSE_NP)
      set(_suffix)
      if(_filter)
        set(_suffix ":${_filter}")
      endif()
      _celeritasaddtest_test_name(_TEST_NAME
        "${_PREFIX}${_BASENAME}${_SUFFIX}" "${_np}" "${_suffix}")
      if(NOT _TEST_NAME)
        continue()
      endif()

      set(_test_env ${PARSE_ENVIRONMENT})
      if(NOT PARSE_DRIVER)
        # Launch with MPI directly
        _celeritasaddtest_mpi_cmd(_test_cmd "${_np}" "${_EXE_NAME}")
      else()
        # Just allow the test to determine the number of procs
        set(_test_cmd "${_EXE_NAME}")
        list(APPEND _test_env "CELERITASTEST_NUMPROCS=${_np}")
      endif()

      set(_test_args "${_EXE_ARGS}")
      if(_filter)
        if(_CELERITASTEST_IS_GTEST)
          list(APPEND _test_args "--gtest_filter=${_filter}")
        elseif(_CELERITASTEST_IS_PYTHON)
          list(APPEND _test_args "${_filter}")
        endif()
      endif()

      add_test(NAME "${_TEST_NAME}" COMMAND ${_test_cmd} ${_test_args})
      list(APPEND _ADDED_TESTS "${_TEST_NAME}")

      if(PARSE_DEPTEST)
        # Add dependency on another test
        _celeritasaddtest_test_name(_deptest_name
          "${PARSE_DEPTEST}" "${_np}" "${_suffix}")
        set_property(TEST "${_TEST_NAME}"
          PROPERTY ADD_DEPENDENCIES "${_deptest_name}")
      endif()

      set_property(TEST ${_TEST_NAME}
        PROPERTY ENVIRONMENT ${_test_env}
      )
      if(_np GREATER 1)
        if(PARSE_NT)
          math(EXPR _np "${_np} * ${PARSE_NT}")
        endif()
        set_property(TEST ${_TEST_NAME}
          PROPERTY PROCESSORS ${_np}
        )
      endif()
    endforeach()
  endforeach()

  if(_ADDED_TESTS)
    # Set common properties
    set_tests_properties(${_ADDED_TESTS}
      PROPERTIES ${_COMMON_PROPS}
      "LABELS" "${_LABELS}")
  endif()
  if(PARSE_ADDED_TESTS)
    # Export test names
    set(${PARSE_ADDED_TESTS} ${_ADDED_TESTS} PARENT_SCOPE)
  endif()
endfunction()

#-----------------------------------------------------------------------------#
********** CeleritasConfig.cmake ***********
#---------------------------------*-CMake-*----------------------------------#
# Copyright 2022-2024 UT-Battelle, LLC, and other Celeritas developers.
# See the top-level COPYRIGHT file for details.
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
#----------------------------------------------------------------------------#

# Set up CMAKE paths
get_filename_component(CELERITAS_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" DIRECTORY)
list(APPEND CMAKE_MODULE_PATH
  "${CELERITAS_CMAKE_DIR}"
)
if(CMAKE_VERSION VERSION_LESS 3.18)
  list(APPEND CMAKE_MODULE_PATH
    "${CELERITAS_CMAKE_DIR}/backport/3.18"
  )
endif()

#-----------------------------------------------------------------------------#
# Version compatibility
#
# To avoid unnecessary strictness (with non-obvious error messages) we do not
# use the `SameMajorVersion`/`SameMinorVersion` argument to
# \c write_basic_package_version_file . Instead we check for any requested
# package version here and warn deliberately if it doesn't match.
#-----------------------------------------------------------------------------#
# TODO for version 1.0.0: update logic to major version
if(((Celeritas_FIND_VERSION_MAJOR EQUAL 0
     AND Celeritas_FIND_VERSION_MINOR LESS Celeritas_VERSION_MINOR)
    OR Celeritas_FIND_VERSION_MAJOR GREATER 0)
   AND NOT Celeritas_FIND_VERSION_MAX VERSION_GREATER_EQUAL Celeritas_VERSION)
   message(AUTHOR_WARNING "Celeritas version ${Celeritas_VERSION} "
     "may not be compatible with requested version "
     "${Celeritas_FIND_VERSION}: please update your find_package "
     "version range"
   )
endif()

#-----------------------------------------------------------------------------#
# Variables
#-----------------------------------------------------------------------------#

set(Celeritas_VERSION_STRING "0.5.0-dev.11+6ae1056f")

# Configuration options
set(CELERITAS_BUILD_DEMOS "ON")
set(CELERITAS_BUILD_DOCS "OFF")
set(CELERITAS_BUILD_TESTS "ON")
set(CELERITAS_CORE_GEO "ORANGE")
set(CELERITAS_CORE_RNG "xorwow")
set(CELERITAS_DEBUG "OFF")
set(CELERITAS_HOSTNAME "a4110de85f02")
set(CELERITAS_MAX_BLOCK_SIZE "256")
set(CELERITAS_PYTHONPATH "/opt/view/misc:/opt/rh/devtoolset-7/root/usr/lib64/python/site-packages:/opt/rh/devtoolset-7/root/usr/lib/python")
set(CELERITAS_REAL_TYPE "double")
set(CELERITAS_TEST_RESOURCE_LOCK "ON")
set(CELERITAS_TEST_VERBOSE "OFF")
set(CELERITAS_UNITS "CGS")
set(CELERITAS_USE_CUDA "OFF")
set(CELERITAS_USE_Geant4 "ON")
set(CELERITAS_USE_HIP "ON")
set(CELERITAS_USE_HepMC3 "ON")
set(CELERITAS_USE_JSON "ON")
set(CELERITAS_USE_MPI "OFF")
set(CELERITAS_USE_OpenMP "ON")
set(CELERITAS_USE_Python "ON")
set(CELERITAS_USE_ROOT "OFF")
set(CELERITAS_USE_SWIG "OFF")
set(CELERITAS_USE_VecGeom "OFF")

# Defaulted variables
set(CELERITAS_CMAKE_EXPORT_NO_PACKAGE_REGISTRY "ON")
set(CELERITAS_CMAKE_FIND_USE_PACKAGE_REGISTRY "FALSE")
set(CELERITAS_CMAKE_FIND_USE_SYSTEM_PACKAGE_REGISTRY "FALSE")
set(CELERITAS_BUILD_TESTING "ON")
set(CELERITAS_CMAKE_CXX_STANDARD "17")
set(CELERITAS_CMAKE_CXX_EXTENSIONS "OFF")
set(CELERITAS_BUILD_SHARED_LIBS "OFF")
set(CELERITAS_CMAKE_INSTALL_RPATH_USE_LINK_PATH "ON")
set(CELERITAS_CMAKE_INSTALL_MESSAGE "LAZY")

# Hints for upstream dependencies
if(NOT DEFINED Geant4_DIR)
  set(Geant4_DIR "/opt/view/lib64/Geant4-11.0.3")
endif()
if(NOT DEFINED GTest_DIR)
  set(GTest_DIR "/opt/view/lib64/cmake/GTest")
endif()
if(NOT DEFINED HepMC3_DIR)
  set(HepMC3_DIR "/opt/view/share/HepMC3/cmake")
endif()
if(NOT DEFINED nlohmann_json_DIR)
  set(nlohmann_json_DIR "/opt/view/share/cmake/nlohmann_json")
endif()
if(NOT DEFINED CLHEP_DIR)
  set(CLHEP_DIR "/opt/software/linux-centos7-x86_64/gcc-7.3.1/clhep-2.4.6.0-7kz2najh4o6e5nbrji7wlqj4dlo2nrxy/lib/CLHEP-2.4.6.0")
endif()
if(NOT DEFINED PTL_DIR)
  set(PTL_DIR "/opt/view/lib64/Geant4-11.0.3/PTL")
endif()
if(NOT DEFINED EXPAT_INCLUDE_DIR)
  set(EXPAT_INCLUDE_DIR "/opt/software/linux-centos7-x86_64/gcc-7.3.1/expat-2.4.8-r4afp64rtmzbxklnlkkjeleaibl665yk/include")
endif()
if(NOT DEFINED EXPAT_LIBRARY)
  set(EXPAT_LIBRARY "/opt/software/linux-centos7-x86_64/gcc-7.3.1/expat-2.4.8-r4afp64rtmzbxklnlkkjeleaibl665yk/lib/libexpat.so")
endif()
if(NOT DEFINED XercesC_LIBRARY)
  set(XercesC_LIBRARY "/opt/software/linux-centos7-x86_64/gcc-7.3.1/xerces-c-3.2.3-gysfmqaecsrbi3n7jm2y6ks433sjyna5/lib/libxerces-c.so")
endif()
if(NOT DEFINED XercesC_INCLUDE_DIR)
  set(XercesC_INCLUDE_DIR "/opt/software/linux-centos7-x86_64/gcc-7.3.1/xerces-c-3.2.3-gysfmqaecsrbi3n7jm2y6ks433sjyna5/include")
endif()

#-----------------------------------------------------------------------------#
# Dependencies
#-----------------------------------------------------------------------------#

include(CMakeFindDependencyMacro)

if(CELERITAS_USE_CUDA)
  enable_language(CUDA)
  find_dependency(CUDAToolkit REQUIRED QUIET)
elseif(CELERITAS_USE_HIP)
  enable_language(HIP)
endif()

if(CELERITAS_USE_Geant4)
  # Geant4 calls `include_directories` for CLHEP :( which is not what we want!
  # Save and restore include directories around the call -- even though as a
  # standalone project Celeritas will never have directory-level includes
  get_directory_property(_include_dirs INCLUDE_DIRECTORIES)
  find_dependency(Geant4 11.0.3 REQUIRED)
  set_directory_properties(PROPERTIES INCLUDE_DIRECTORIES "${_include_dirs}")
endif()

if(CELERITAS_USE_HepMC3)
  find_dependency(HepMC3 3.02.05 REQUIRED)
endif()

if(CELERITAS_USE_JSON)
  find_dependency(nlohmann_json 3.11.2 REQUIRED)
endif()

if(CELERITAS_USE_MPI)
  find_dependency(MPI REQUIRED)
endif()

if(CELERITAS_USE_OpenMP)
  find_dependency(OpenMP REQUIRED)
endif()

if(CELERITAS_USE_Python)
  set(_components Interpreter)
  set(_version 3.6)
  if(CELERITAS_USE_SWIG)
    list(APPEND _components Development)
    set(_version 3.10.8)
  endif()
  find_dependency(Python ${_version} REQUIRED COMPONENTS ${_components})
  unset(_components)
  unset(_version)
endif()

if(CELERITAS_USE_ROOT)
  find_dependency(ROOT  REQUIRED)
endif()

if(CELERITAS_USE_VecGeom)
  find_dependency(VecGeom  REQUIRED)

  if(CELERITAS_USE_CUDA AND NOT VecGeom_CUDA_FOUND)
    message(SEND_ERROR "CUDA mismatch between the VecGeom installation "
      "at ${VECGEOM_INSTALL_DIR} (VecGeom_CUDA_FOUND=${VecGeom_CUDA_FOUND}) "
      "and Celeritas (CELERITAS_USE_CUDA=${CELERITAS_USE_CUDA})"
    )
  endif()
  if(NOT VecGeom_GDML_FOUND)
    message(SEND_ERROR "VecGeom GDML capability is required for Celeritas")
  endif()
endif()

if(CELERITAS_BUILD_TESTS)
  if(CMAKE_VERSION VERSION_LESS 3.20)
    # First look for standard CMake installation
    # (automatically done for CMake >= 3.20)
    find_dependency(GTest 1.12.1 QUIET NO_MODULE)
  endif()
  if(NOT GTest_FOUND)
    # If not found, try again
    find_dependency(GTest)
  endif()
endif()

#-----------------------------------------------------------------------------#
# Targets
#-----------------------------------------------------------------------------#

if(NOT TARGET celeritas)
  include("${CELERITAS_CMAKE_DIR}/CeleritasTargets.cmake")
endif()

#-----------------------------------------------------------------------------#

foreach(_dep CUDA ROOT Geant4 VecGeom MPI OpenMP)
  set(Celeritas_${_dep}_FOUND ${CELERITAS_USE_${_dep}})
endforeach()

#-----------------------------------------------------------------------------#
********** CeleritasConfigVersion.cmake ***********
# This is a basic version file for the Config-mode of find_package().
# It is used by write_basic_package_version_file() as input file for configure_file()
# to create a version-file which can be installed along a config.cmake file.
#
# The created file sets PACKAGE_VERSION_EXACT if the current version string and
# the requested version string are exactly the same and it sets
# PACKAGE_VERSION_COMPATIBLE if the current version is >= requested version.
# The variable CVF_VERSION must be set before calling configure_file().

set(PACKAGE_VERSION "0.5.0")

if (PACKAGE_FIND_VERSION_RANGE)
  # Package version must be in the requested version range
  if ((PACKAGE_FIND_VERSION_RANGE_MIN STREQUAL "INCLUDE" AND PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION_MIN)
      OR ((PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "INCLUDE" AND PACKAGE_VERSION VERSION_GREATER PACKAGE_FIND_VERSION_MAX)
        OR (PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "EXCLUDE" AND PACKAGE_VERSION VERSION_GREATER_EQUAL PACKAGE_FIND_VERSION_MAX)))
    set(PACKAGE_VERSION_COMPATIBLE FALSE)
  else()
    set(PACKAGE_VERSION_COMPATIBLE TRUE)
  endif()
else()
  if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION)
    set(PACKAGE_VERSION_COMPATIBLE FALSE)
  else()
    set(PACKAGE_VERSION_COMPATIBLE TRUE)
    if(PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION)
      set(PACKAGE_VERSION_EXACT TRUE)
    endif()
  endif()
endif()


# if the installed project requested no architecture check, don't perform the check
if("FALSE")
  return()
endif()

# if the installed or the using project don't have CMAKE_SIZEOF_VOID_P set, ignore it:
if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "" OR "8" STREQUAL "")
  return()
endif()

# check that the installed version has the same 32/64bit-ness as the one which is currently searching:
if(NOT CMAKE_SIZEOF_VOID_P STREQUAL "8")
  math(EXPR installedBits "8 * 8")
  set(PACKAGE_VERSION "${PACKAGE_VERSION} (${installedBits}bit)")
  set(PACKAGE_VERSION_UNSUITABLE TRUE)
endif()
********** CeleritasLibrary.cmake ***********
#----------------------------------*-CMake-*----------------------------------#
# Copyright 2020-2024 UT-Battelle, LLC, and other Celeritas developers.
# See the top-level COPYRIGHT file for details.
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
#[=======================================================================[.rst:

CeleritasLibrary
----------------

The set of functions here are required to link Celeritas against upstream
relocatable device code in the VecGeom library.

.. command:: celeritas_rdc_add_library

  Add a library to the project using the specified source files *with* special handling
  for the case where the library contains CUDA relocatable device code.

  ::

    celeritas_rdc_add_library(<name> [STATIC | SHARED | MODULE]
            [EXCLUDE_FROM_ALL]
            [<source>...])

  To support CUDA relocatable device code, the following 4 targets will be constructed:

  - A object library used to compile the source code and share the result with the static and shared library
  - A static library used as input to ``nvcc -dlink``
  - A shared ���intermediary��� library containing all the ``.o`` files but NO ``nvcc -dlink`` result
  - A shared ���final��� library containing the result of ``nvcc -dlink`` and linked against the "intermediary" shared library.

  An executable needs to load exactly one result of ``nvcc -dlink`` whose input needs to be
  the ``.o`` files from all the CUDA libraries it uses/depends-on. So if the executable has CUDA code,
  it will call ``nvcc -dlink`` itself and link against the "intermediary" shared libraries.
  If the executable has no CUDA code, then it needs to link against the "final" library
  (of its most derived dependency). If the executable has no CUDA code but uses more than one
  CUDA library, it will still need to run its own ``nvcc -dlink`` step.


.. command:: celeritas_target_link_libraries

  Specify libraries or flags to use when linking a given target and/or its dependents, taking
  in account the extra targets (see celeritas_rdc_add_library) needed to support CUDA relocatable
  device code.

    ::

      celeritas_target_link_libraries(<target>
        <PRIVATE|PUBLIC|INTERFACE> <item>...
        [<PRIVATE|PUBLIC|INTERFACE> <item>...]...))

  Usage requirements from linked library targets will be propagated to all four targets. Usage requirements
  of a target's dependencies affect compilation of its own sources. In the case that ``<target>`` does
  not contain CUDA code, the command decays to ``target_link_libraries``.

  See ``target_link_libraries`` for additional detail.


.. command:: celeritas_target_include_directories

  Add include directories to a target.

    ::

      celeritas_target_include_directories(<target> [SYSTEM] [AFTER|BEFORE]
        <INTERFACE|PUBLIC|PRIVATE> [items1...]
        [<INTERFACE|PUBLIC|PRIVATE> [items2...] ...])

  Specifies include directories to use when compiling a given target. The named <target>
  must have been created by a command such as celeritas_rdc_add_library(), add_executable() or add_library(),
  and can be used with an ALIAS target. It is aware of the 4 underlying targets (objects, static,
  middle, final) present when the input target was created celeritas_rdc_add_library() and will propagate
  the include directories to all four. In the case that ``<target>`` does not contain CUDA code,
  the command decays to ``target_include_directories``.

  See ``target_include_directories`` for additional detail.


.. command:: celeritas_install

  Specify installation rules for a CUDA RDC target.

    ::
      celeritas_install(TARGETS targets... <ARGN>)

  In the case that an input target does not contain CUDA code, the command decays
  to ``install``.

  See ``install`` for additional detail.

.. command:: celeritas_target_compile_options

   Specify compile options for a CUDA RDC target

     ::
       celeritas_target_compile_options(<target> [BEFORE]
         <INTERFACE|PUBLIC|PRIVATE> [items1...]
         [<INTERFACE|PUBLIC|PRIVATE> [items2...] ...])

  In the case that an input target does not contain CUDA code, the command decays
  to ``target_compile_options``.

  See ``target_compile_options`` for additional detail.

#]=======================================================================]

include_guard(GLOBAL)

#-----------------------------------------------------------------------------#

define_property(TARGET PROPERTY CELERITAS_CUDA_LIBRARY_TYPE
  BRIEF_DOCS "Indicate the type of cuda library (STATIC and SHARED for nvlink usage, FINAL for linking into not cuda library/executable"
  FULL_DOCS "Indicate the type of cuda library (STATIC and SHARED for nvlink usage, FINAL for linking into not cuda library/executable"
)
define_property(TARGET PROPERTY CELERITAS_CUDA_FINAL_LIBRARY
  BRIEF_DOCS "Name of the final library corresponding to this cuda library"
  FULL_DOCS "Name of the final library corresponding to this cuda library"
)
define_property(TARGET PROPERTY CELERITAS_CUDA_STATIC_LIBRARY
  BRIEF_DOCS "Name of the static library corresponding to this cuda library"
  FULL_DOCS "Name of the static library corresponding to this cuda library"
)
define_property(TARGET PROPERTY CELERITAS_CUDA_MIDDLE_LIBRARY
  BRIEF_DOCS "Name of the shared (without nvlink step) library corresponding to this cuda library"
  FULL_DOCS "Name of the shared (without nvlink step) library corresponding to this cuda library"
)
define_property(TARGET PROPERTY CELERITAS_CUDA_OBJECT_LIBRARY
  BRIEF_DOCS "Name of the object (without nvlink step) library corresponding to this cuda library"
  FULL_DOCS "Name of the object (without nvlink step) library corresponding to this cuda library"
)

##############################################################################
# Separate the OPTIONS out from the sources
#
macro(cuda_get_sources_and_options _sources _cmake_options _options)
  set( ${_sources} )
  set( ${_cmake_options} )
  set( ${_options} )
  set( _found_options FALSE )
  foreach(arg ${ARGN})
    if(arg STREQUAL "OPTIONS")
      set( _found_options TRUE )
    elseif(
        arg STREQUAL "WIN32" OR
        arg STREQUAL "MACOSX_BUNDLE" OR
        arg STREQUAL "EXCLUDE_FROM_ALL" OR
        arg STREQUAL "STATIC" OR
        arg STREQUAL "SHARED" OR
        arg STREQUAL "MODULE"
        )
      list(APPEND ${_cmake_options} ${arg})
    else()
      if( _found_options )
        list(APPEND ${_options} ${arg})
      else()
        # Assume this is a file
        list(APPEND ${_sources} ${arg})
      endif()
    endif()
  endforeach()
endmacro()

#-----------------------------------------------------------------------------#
#
# Internal routine to figure out if a list contains
# CUDA source code.  Returns empty or the list of CUDA files in the var
#
function(celeritas_sources_contains_cuda var)
  set(_result)
  foreach(_source ${ARGN})
    get_source_file_property(_iscudafile "${_source}" LANGUAGE)
    if(_iscudafile STREQUAL "CUDA")
      list(APPEND _result "${_source}")
    elseif(NOT _iscudafile)
      get_filename_component(_ext "${_source}" LAST_EXT)
      if(_ext STREQUAL ".cu")
        list(APPEND _result "${_source}")
      endif()
    endif()
  endforeach()
  set(${var} "${_result}" PARENT_SCOPE)
endfunction()

#-----------------------------------------------------------------------------#
#
# Internal routine to figure out if a target already contains
# CUDA source code.  Returns empty or list of CUDA files in the OUTPUT_VARIABLE
#
function(celeritas_lib_contains_cuda OUTPUT_VARIABLE target)
  celeritas_strip_alias(target ${target})

  get_target_property(_targettype ${target} CELERITAS_CUDA_LIBRARY_TYPE)
  if(_targettype)
    # The target is one of the components of a library with CUDA separatable code,
    # no need to check the source files.
    set(${OUTPUT_VARIABLE} TRUE PARENT_SCOPE)
  else()
    get_target_property(_target_sources ${target} SOURCES)
    celeritas_sources_contains_cuda(_contains_cuda ${_target_sources})
    set(${OUTPUT_VARIABLE} ${_contains_cuda} PARENT_SCOPE)
  endif()
endfunction()

#-----------------------------------------------------------------------------#
#
# Generate an empty .cu file to transform the library to a CUDA library
#
function(celeritas_generate_empty_cu_file emptyfilenamevar target)
  set(_stub "${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${target}_emptyfile.cu")
  if(NOT EXISTS ${_stub})
    file(WRITE "${_stub}" "/* intentionally empty. */")
  endif()
  set(${emptyfilenamevar} ${_stub} PARENT_SCOPE)
endfunction()

#-----------------------------------------------------------------------------#
#
# Transfer the setting \${what} (both the PUBLIC and INTERFACE version) to from library \${fromlib} to the library \${tolib} that depends on it
#
function(celeritas_transfer_setting fromlib tolib what)
  get_target_property(_temp ${fromlib} ${what})
  if(_temp)
    cmake_language(CALL target_${what} ${tolib} PUBLIC ${_temp})
  endif()
  get_target_property(_temp ${fromlib} INTERFACE_${what})
  if(_temp)
    cmake_language(CALL target_${what} ${tolib} PUBLIC ${_temp})
  endif()
endfunction()

#-----------------------------------------------------------------------------#
# celeritas_rdc_add_library
#
# Add a library taking into account whether it contains
# or depends on separatable CUDA code.  If it contains
# cuda code, it will be marked as "separatable compilation"
# (i.e. request "Relocatable device code")
#
function(celeritas_rdc_add_library target)

  cuda_get_sources_and_options(_sources _cmake_options _options ${ARGN})

  celeritas_sources_contains_cuda(_cuda_sources ${_sources})

  if(CELERITAS_USE_HIP AND _cuda_sources)
    # When building Celeritas libraries, we put HIP/CUDA files in shared .cu
    # suffixed files. Override the language if using HIP.
    set_source_files_properties(
      ${_cuda_sources}
      PROPERTIES LANGUAGE HIP
    )
  endif()

  # Whether we need the special code or not is actually dependent on information
  # we don't have ... yet
  # - whether the user request CUDA_SEPARABLE_COMPILATION
  # - whether the library depends on a library with CUDA_SEPARABLE_COMPILATION code.
  # I.e. this should really be done at generation time.
  # So in the meantime we use rely on the user to call this routine
  # only in the case where they want the CUDA device code to be compiled
  # as "relocatable device code"

  if(NOT CELERITAS_USE_VecGeom OR NOT CMAKE_CUDA_COMPILER OR NOT _cuda_sources)
    add_library(${target} ${ARGN})
    return()
  endif()

  cmake_parse_arguments(_ADDLIB_PARSE
    "STATIC;SHARED;MODULE;OBJECT"
    ""
    ""
    ${ARGN}
  )
  set(_lib_requested_type "SHARED")
  set(_cudaruntime_requested_type "Shared")
  set(_staticsuf "_static")
  if((NOT BUILD_SHARED_LIBS AND NOT _ADDLIB_PARSE_SHARED AND NOT _ADDLIB_PARSE_MODULE)
      OR _ADDLIB_PARSE_STATIC)
    set(_lib_requested_type "STATIC")
    set(_cudaruntime_requested_type "Static")
    set(_staticsuf "")
  endif()
  if(_ADDLIB_PARSE_MODULE)
    add_library(${target} ${ARGN})
    set_target_properties(${target} PROPERTIES
      CUDA_SEPARABLE_COMPILATION ON
      CUDA_RUNTIME_LIBRARY ${_cudaruntime_requested_type}
    )
    return()
  endif()
  if(_ADDLIB_PARSE_OBJECT)
    message(FATAL_ERROR "celeritas_rdc_add_library does not support OBJECT library")
  endif()

  ## OBJECTS ##

  add_library(${target}_objects OBJECT ${_ADDLIB_PARSE_UNPARSED_ARGUMENTS})
  set(_object_props
    CUDA_SEPARABLE_COMPILATION ON
    CUDA_RUNTIME_LIBRARY ${_cudaruntime_requested_type}
  )
  if(_lib_requested_type STREQUAL "SHARED")
    list(APPEND _object_props
      POSITION_INDEPENDENT_CODE ON
    )
  endif()
  set_target_properties(${target}_objects PROPERTIES ${_object_props})

  ## MIDDLE (main library) ##

  add_library(${target} ${_lib_requested_type}
    $<TARGET_OBJECTS:${target}_objects>
  )
  set(_common_props
    ${_object_props}
    LINKER_LANGUAGE CUDA
    CELERITAS_CUDA_FINAL_LIBRARY Celeritas::${target}_final
    CELERITAS_CUDA_MIDDLE_LIBRARY Celeritas::${target}
    CELERITAS_CUDA_STATIC_LIBRARY Celeritas::${target}${_staticsuf}
    CELERITAS_CUDA_OBJECT_LIBRARY ${target}_objects
  )
  set_target_properties(${target} PROPERTIES
    ${_common_props}
    CELERITAS_CUDA_LIBRARY_TYPE Shared
    CUDA_RESOLVE_DEVICE_SYMBOLS OFF # We really don't want nvlink called.
    EXPORT_PROPERTIES "CELERITAS_CUDA_LIBRARY_TYPE;CELERITAS_CUDA_FINAL_LIBRARY;CELERITAS_CUDA_MIDDLE_LIBRARY;CELERITAS_CUDA_STATIC_LIBRARY"
  )

  ## STATIC ##

  if(_staticsuf)
    add_library(${target}${_staticsuf} STATIC
      $<TARGET_OBJECTS:${target}_objects>
    )
    add_library(Celeritas::${target}${_staticsuf} ALIAS ${target}${_staticsuf})
    set_target_properties(${target}${_staticsuf} PROPERTIES
      ${_common_props}
      CELERITAS_CUDA_LIBRARY_TYPE Static
      EXPORT_PROPERTIES "CELERITAS_CUDA_LIBRARY_TYPE;CELERITAS_CUDA_FINAL_LIBRARY;CELERITAS_CUDA_MIDDLE_LIBRARY;CELERITAS_CUDA_STATIC_LIBRARY"
    )
  endif()

  ## FINAL (dlink) ##

  # We need to use a dummy file as a library (per cmake) needs to contains
  # at least one source file.  The real content of the library will be
  # the cmake_device_link.o resulting from the execution of `nvcc -dlink`
  # Also non-cuda related test, for example `gtest_detail_Macros`,
  # will need to be linked again libceleritas_final while a library
  # that the depends on and that uses Celeritas::Core (for example
  # libCeleritasTest.so) will need to be linked against `libceleritas`.
  # If both the middle and `_final` contains the `.o` files we would
  # then have duplicated symbols .  If both the middle and `_final`
  # library contained the result of `nvcc -dlink` then we would get
  # conflicting but duplicated *weak* symbols and here the symptoms
  # will be a crash during the cuda library initialization or a failure to
  # launch some kernels rather than a link error.
  celeritas_generate_empty_cu_file(_emptyfilename ${target})
  add_library(${target}_final ${_lib_requested_type} ${_emptyfilename})
  add_library(Celeritas::${target}_final ALIAS ${target}_final)
  set_target_properties(${target}_final PROPERTIES
    ${_common_props}
    LINK_DEPENDS $<TARGET_FILE:${target}${_staticsuf}>
    CELERITAS_CUDA_LIBRARY_TYPE Final
    CUDA_RESOLVE_DEVICE_SYMBOLS ON
    EXPORT_PROPERTIES "CELERITAS_CUDA_LIBRARY_TYPE;CELERITAS_CUDA_FINAL_LIBRARY;CELERITAS_CUDA_MIDDLE_LIBRARY;CELERITAS_CUDA_STATIC_LIBRARY"
  )
  target_link_libraries(${target}_final PUBLIC ${target} PRIVATE CUDA::toolkit)
  target_link_options(${target}_final
    PRIVATE $<DEVICE_LINK:$<TARGET_FILE:${target}${_staticsuf}>>
  )
  add_dependencies(${target}_final ${target}${_staticsuf})
endfunction()

# Replacement for target_include_directories that is aware of
# the 4 libraries (objects, static, middle, final) libraries needed
# for a separatable CUDA library
function(celeritas_target_include_directories target)
  if(NOT CMAKE_CUDA_COMPILER)
    target_include_directories(${ARGV})
    return()
  endif()

  celeritas_strip_alias(target ${target})
  celeritas_lib_contains_cuda(_contains_cuda ${target})

  if(_contains_cuda)
    get_target_property(_targettype ${target} CELERITAS_CUDA_LIBRARY_TYPE)
    if(_targettype)
      get_target_property(_target_middle ${target} CELERITAS_CUDA_MIDDLE_LIBRARY)
      get_target_property(_target_object ${target} CELERITAS_CUDA_OBJECT_LIBRARY)
    endif()
  endif()
  if(_target_object)
    target_include_directories(${_target_object} ${ARGN})
  endif()
  if(_target_middle)
    celeritas_strip_alias(_target_middle ${_target_middle})
    target_include_directories(${_target_middle} ${ARGN})
  else()
    target_include_directories(${ARGV})
  endif()
endfunction()

#-----------------------------------------------------------------------------#
# Replacement for target_compile_options that is aware of
# the 4 libraries (objects, static, middle, final) libraries needed
# for a separatable CUDA library
function(celeritas_target_compile_options target)
  if(NOT CELERITAS_USE_CUDA)
    target_compile_options(${ARGV})
    return()
  endif()

  celeritas_strip_alias(target ${target})
  celeritas_lib_contains_cuda(_contains_cuda ${target})

  if(_contains_cuda)
    get_target_property(_targettype ${target} CELERITAS_CUDA_LIBRARY_TYPE)
    if(_targettype)
      get_target_property(_target_middle ${target} CELERITAS_CUDA_MIDDLE_LIBRARY)
      get_target_property(_target_object ${target} CELERITAS_CUDA_OBJECT_LIBRARY)
    endif()
  endif()
  if(_target_object)
    target_compile_options(${_target_object} ${ARGN})
  endif()
  if(_target_middle)
    celeritas_strip_alias(_target_middle ${_target_middle})
    target_compile_options(${_target_middle} ${ARGN})
  else()
    target_compile_options(${ARGV})
  endif()
endfunction()

#-----------------------------------------------------------------------------#
#
# Replacement for the install function that is aware of the 3 libraries
# (static, middle, final) libraries needed for a separatable CUDA library
#
function(celeritas_install subcommand firstarg)
  if(NOT subcommand STREQUAL "TARGETS" OR NOT TARGET ${firstarg})
    install(${ARGV})
    return()
  endif()
  set(_targets ${firstarg})
  list(POP_FRONT ARGN _next)
  while(TARGET ${_next})
    list(APPEND _targets ${_next})
    list(POP_FRONT ${ARGN} _next)
  endwhile()
  # At this point all targets are in ${_targets} and ${_next} is the first non target and ${ARGN} is the rest.
  foreach(_toinstall ${_targets})
    celeritas_strip_alias(_prop_target ${_toinstall})
    get_target_property(_lib_target_type ${_prop_target} TYPE)
    if(NOT _lib_target_type STREQUAL "INTERFACE_LIBRARY")
      get_target_property(_targettype ${_prop_target} CELERITAS_CUDA_LIBRARY_TYPE)
      if(_targettype)
        get_target_property(_target_final ${_prop_target} CELERITAS_CUDA_FINAL_LIBRARY)
        get_target_property(_target_middle ${_prop_target} CELERITAS_CUDA_MIDDLE_LIBRARY)
        get_target_property(_target_static ${_prop_target} CELERITAS_CUDA_STATIC_LIBRARY)
        set(_toinstall ${_target_final} ${_target_middle} ${_target_static})
        if(NOT _target_middle STREQUAL _target_static)
          # Avoid duplicate middle/static library for static builds
          list(APPEND _toinstall ${_target_middle})
        endif()
      endif()
    endif()
    install(TARGETS ${_toinstall} ${_next} ${ARGN})
  endforeach()
endfunction()

#-----------------------------------------------------------------------------#
# Return TRUE if 'lib' depends/uses directly or indirectly the library `potentialdepend`
function(celeritas_depends_on OUTVARNAME lib potentialdepend)
  set(${OUTVARNAME} FALSE PARENT_SCOPE)
  if(TARGET ${lib} AND TARGET ${potentialdepend})
    set(lib_link_libraries "")
    get_target_property(_lib_target_type ${lib} TYPE)
    if(NOT _lib_target_type STREQUAL "INTERFACE_LIBRARY")
      get_target_property(lib_link_libraries ${lib} LINK_LIBRARIES)
    endif()
    foreach(linklib ${lib_link_libraries})
      if(linklib STREQUAL potentialdepend)
        set(${OUTVARNAME} TRUE PARENT_SCOPE)
        return()
      endif()
      celeritas_depends_on(${OUTVARNAME} ${linklib} ${potentialdepend})
      if(${OUTVARNAME})
        set(${OUTVARNAME} ${${OUTVARNAME}} PARENT_SCOPE)
        return()
      endif()
    endforeach()
  endif()
endfunction()

#-----------------------------------------------------------------------------#
# Return the 'real' target name whether the output is an alias or not.
function(celeritas_strip_alias OUTVAR target)
  if(TARGET ${target})
    get_target_property(_target_alias ${target} ALIASED_TARGET)
  endif()
  if(TARGET ${_target_alias})
    set(target ${_target_alias})
  endif()
  set(${OUTVAR} ${target} PARENT_SCOPE)
endfunction()

#-----------------------------------------------------------------------------#
# Return the middle/shared library of the target, if any.
macro(celeritas_get_library_middle_target outvar target)
  get_target_property(_target_type ${target} TYPE)
  if(NOT _target_type STREQUAL "INTERFACE_LIBRARY")
    get_target_property(${outvar} ${target} CELERITAS_CUDA_MIDDLE_LIBRARY)
  else()
    set(${outvar} ${target})
  endif()
endmacro()

#-----------------------------------------------------------------------------#
# Retrieve the "middle" library, i.e. given a target, the
# target name to be used as input to the linker of dependent libraries.
function(celeritas_use_middle_lib_in_property target property)
  get_target_property(_target_libs ${target} ${property})

  set(_new_values)
  foreach(_lib ${_target_libs})
    set(_newlib ${_lib})
    if(TARGET ${_lib})
      celeritas_strip_alias(_lib ${_lib})
      celeritas_get_library_middle_target(_libmid ${_lib})
      if(_libmid)
        set(_newlib ${_libmid})
      endif()
    endif()
    list(APPEND _new_values ${_newlib})
  endforeach()

  if(_new_values)
    set_target_properties(${target} PROPERTIES
      ${property} "${_new_values}"
    )
  endif()
endfunction()

#-----------------------------------------------------------------------------#
# Return the most derived "separatable cuda" library the target depends on.
# If two or more cuda library are independent, we return both and the calling executable
# should be linked with nvcc -dlink.
function(celeritas_find_final_library OUTLIST flat_dependency_list)
  set(_result "")
  foreach(_lib ${flat_dependency_list})
    if(NOT _result)
      list(APPEND _result ${_lib})
    else()
      set(_newresult "")
      foreach(_reslib ${_result})
        celeritas_depends_on(_depends_on ${_lib} ${_reslib})
        celeritas_depends_on(_depends_on ${_reslib} ${_lib})

        celeritas_depends_on(_depends_on ${_reslib} ${_lib})
        if(${_depends_on})
          # The library in the result depends/uses the library we are looking at,
          # let's keep the ones from result
          set(_newresult ${_result})
          break()
          # list(APPEND _newresult ${_reslib})
        else()
          celeritas_depends_on(_depends_on ${_lib} ${_reslib})
          if(${_depends_on})
            # We are in the opposite case, let's keep the library we are looking at
            list(APPEND _newresult ${_lib})
          else()
            # Unrelated keep both
            list(APPEND _newresult ${_reslib})
            list(APPEND _newresult ${_lib})
          endif()
        endif()
      endforeach()
      set(_result ${_newresult})
    endif()
  endforeach()
  list(REMOVE_DUPLICATES _result)
  set(_final_result "")
  foreach(_lib ${_result})
    if(TARGET ${_lib})
      get_target_property(_lib_target_type ${_lib} TYPE)
      if(NOT _lib_target_type STREQUAL "INTERFACE_LIBRARY")
        get_target_property(_final_lib ${_lib} CELERITAS_CUDA_FINAL_LIBRARY)
        if(_final_lib)
          list(APPEND _final_result ${_final_lib})
        endif()
      endif()
    endif()
  endforeach()
  set(${OUTLIST} ${_final_result} PARENT_SCOPE)
endfunction()

#-----------------------------------------------------------------------------#
#
#  Check which CUDA runtime is needed for a given (dependent) library.
function(celeritas_check_cuda_runtime OUTVAR library)

  get_target_property(_runtime_setting ${library} CUDA_RUNTIME_LIBRARY)
  if(NOT _runtime_setting)
    # We could get more exact information by using:
    #  file(GET_RUNTIME_DEPENDENCIES LIBRARIES ${_lib_loc} UNRESOLVED_DEPENDENCIES_VAR _lib_dependcies)
    # but we get
    #   You have used file(GET_RUNTIME_DEPENDENCIES) in project mode.  This is
    #     probably not what you intended to do.
    # On the other hand, if the library is using (relocatable) CUDA code and
    # the shared run-time library and we don't have the scafolding libraries
    # (shared/static/final) then this won't work well. i.e. if we were to detect this
    # case we probably need to 'error out'.
    get_target_property(_cuda_library_type ${library} CELERITAS_CUDA_LIBRARY_TYPE)
    get_target_property(_cuda_find_library ${library} CELERITAS_CUDA_FINAL_LIBRARY)
    if(_cuda_library_type STREQUAL "Shared")
      set_target_properties(${library} PROPERTIES CUDA_RUNTIME_LIBRARY "Shared")
      set(_runtime_setting "Shared")
    elseif(NOT _cuda_find_library)
      set_target_properties(${library} PROPERTIES CUDA_RUNTIME_LIBRARY "None")
      set(_runtime_setting "None")
    else()
      # If we have a final library then the library is shared.
      set_target_properties(${library} PROPERTIES CUDA_RUNTIME_LIBRARY "Shared")
      set(_runtime_setting "Shared")
    endif()
  endif()

  set(${OUTVAR} ${_runtime_setting} PARENT_SCOPE)
endfunction()


#-----------------------------------------------------------------------------#
# Replacement for target_link_libraries that is aware of
# the 3 libraries (static, middle, final) libraries needed
# for a separatable CUDA library
function(celeritas_target_link_libraries target)
  if(NOT CMAKE_CUDA_COMPILER)
    target_link_libraries(${ARGV})
    return()
  endif()

  celeritas_strip_alias(target ${target})

  celeritas_lib_contains_cuda(_contains_cuda ${target})

  set(_target_final ${target})
  set(_target_middle ${target})
  if(_contains_cuda)
    get_target_property(_targettype ${target} CELERITAS_CUDA_LIBRARY_TYPE)
    if(_targettype)
      get_target_property(_target_final ${target} CELERITAS_CUDA_FINAL_LIBRARY)
      get_target_property(_target_middle ${target} CELERITAS_CUDA_MIDDLE_LIBRARY)
      get_target_property(_target_object ${target} CELERITAS_CUDA_OBJECT_LIBRARY)
    endif()
  endif()

  # Set now to let target_link_libraries do the argument parsing
  celeritas_strip_alias(_target_middle ${_target_middle})
  target_link_libraries(${_target_middle} ${ARGN})

  celeritas_use_middle_lib_in_property(${_target_middle} INTERFACE_LINK_LIBRARIES)
  celeritas_use_middle_lib_in_property(${_target_middle} LINK_LIBRARIES)

  if(_target_object)
    target_link_libraries(${_target_object} ${ARGN})
    celeritas_use_middle_lib_in_property(${_target_object} INTERFACE_LINK_LIBRARIES)
    celeritas_use_middle_lib_in_property(${_target_object} LINK_LIBRARIES)
  endif()

  celeritas_cuda_gather_dependencies(_alldependencies ${target})
  celeritas_find_final_library(_finallibs "${_alldependencies}")

  get_target_property(_target_type ${target} TYPE)
  if(_target_type STREQUAL "EXECUTABLE"
     OR _target_type STREQUAL "MODULE_LIBRARY")
    list(LENGTH _finallibs _final_count)
    if(_contains_cuda)
      if(${_final_count} GREATER 0)
        # If there is at least one final library this means that we
        # have somewhere some "separable" nvcc compilations
        set_target_properties(${target} PROPERTIES
          CUDA_SEPARABLE_COMPILATION ON
        )
      endif()
    elseif(${_final_count} EQUAL 1)
      set_target_properties(${target} PROPERTIES
        # If cmake detects that a library depends/uses a static library
        # linked with CUDA, it will turn CUDA_RESOLVE_DEVICE_SYMBOLS ON
        # leading to a call to nvlink.  If we let this through (at least
        # in case of Celeritas) we would need to add the DEVICE_LINK options
        # also on non cuda libraries (that we detect depends on a cuda library).
        # Note: we might be able to move this to celeritas_target_link_libraries
        CUDA_RESOLVE_DEVICE_SYMBOLS OFF
      )
      get_target_property(_final_target_type ${target} TYPE)

      get_target_property(_final_runtime ${_finallibs} CUDA_RUNTIME_LIBRARY)
      if(_final_runtime STREQUAL "Shared")
        set_target_properties(${target} PROPERTIES CUDA_RUNTIME_LIBRARY "Shared")
      endif()

      if(_final_target_type STREQUAL "STATIC_LIBRARY")
        # for static libraries we need to list the libraries a second time (to resolve symbol from the final library)
        get_target_property(_current_link_libraries ${target} LINK_LIBRARIES)
        set_property(TARGET ${target} PROPERTY LINK_LIBRARIES ${_current_link_libraries} ${_finallibs} ${_current_link_libraries} )
      else()
        # We could have used:
        #    target_link_libraries(${target} PUBLIC ${_finallibs})
        # but target_link_libraries must used either all plain arguments or all plain
        # keywords and at the moment I don't know how to detect which of the 2 style the
        # user used.
        # Maybe we could use:
        #     if(ARGV1 MATCHES "^(PRIVATE|PUBLIC|INTERFACE)$")
        # or simply keep the following:
        get_target_property(_current_link_libraries ${target} LINK_LIBRARIES)
        set_property(TARGET ${target} PROPERTY LINK_LIBRARIES ${_current_link_libraries} ${_finallibs} )
      endif()
    elseif(${_final_count} GREATER 1)
      # turn into CUDA executable.
      set(_contains_cuda TRUE)
      celeritas_generate_empty_cu_file(_emptyfilename ${target})
      target_sources(${target} PRIVATE ${_emptyfilename})
    endif()
    # nothing to do if there is no final library (i.e. no use of CUDA at all?)
  endif()

  if(_contains_cuda)
    set(_need_to_use_shared_runtime FALSE)
    get_target_property(_current_runtime_setting ${target} CUDA_RUNTIME_LIBRARY)
    if(_current_runtime_setting)
       set(_target_runtime_setting ${_current_runtime_setting})
    endif()
    celeritas_cuda_gather_dependencies(_flat_target_link_libraries ${_target_middle})
    foreach(_lib ${_flat_target_link_libraries})
      get_target_property(_lib_target_type ${_lib} TYPE)
      if(NOT _lib_target_type STREQUAL "INTERFACE_LIBRARY")
        celeritas_check_cuda_runtime(_lib_runtime_setting ${_lib})
        if(NOT _need_to_use_shared_runtime AND _lib_runtime_setting STREQUAL "Shared")
          set(_need_to_use_shared_runtime TRUE)
        endif()
        if(NOT _target_runtime_setting)
          if(_lib_runtime_setting)
            set(_target_runtime_setting ${_lib_runtime_setting})
          endif()
        else()
          if(_lib_runtime_setting AND NOT (_target_runtime_setting STREQUAL _lib_runtime_setting))
            # We need to match the dependent library since we can not change it.
            set(_target_runtime_setting ${_lib_runtime_setting})
          endif()
        endif()
        if(NOT _current_runtime_setting)
          set_target_properties(${target} PROPERTIES CUDA_RUNTIME_LIBRARY ${_target_runtime_setting})
        endif()
        get_target_property(_libstatic ${_lib} CELERITAS_CUDA_STATIC_LIBRARY)
        if(TARGET ${_libstatic})
          celeritas_strip_alias(_target_final ${_target_final})
          target_link_options(${_target_final}
            PRIVATE
            $<DEVICE_LINK:$<TARGET_FILE:${_libstatic}>>
          )
          set_property(TARGET ${_target_final} APPEND
            PROPERTY LINK_DEPENDS $<TARGET_FILE:${_libstatic}>
          )

          # Also pass on the the options and definitions.
          celeritas_transfer_setting(${_libstatic} ${_target_final} COMPILE_OPTIONS)
          celeritas_transfer_setting(${_libstatic} ${_target_final} COMPILE_DEFINITIONS)
          celeritas_transfer_setting(${_libstatic} ${_target_final} LINK_OPTIONS)

          add_dependencies(${_target_final} ${_libstatic})
        endif()
      endif()
    endforeach()


    if(_need_to_use_shared_runtime)
      get_target_property(_current_runtime ${target} CUDA_RUNTIME_LIBRARY)
      if(NOT _current_runtime STREQUAL "Shared")
        set_target_properties(${_target_middle} PROPERTIES CUDA_RUNTIME_LIBRARY "Shared")
        set_target_properties(${_target_final} PROPERTIES CUDA_RUNTIME_LIBRARY "Shared")
        set_target_properties(${_target_object} PROPERTIES CUDA_RUNTIME_LIBRARY "Shared")
      endif()
    endif()
  else() # We could restrict to the case where the dependent is a static library ... maybe
    set_target_properties(${target} PROPERTIES
      # If cmake detects that a library depends/uses a static library
      # linked with CUDA, it will turn CUDA_RESOLVE_DEVICE_SYMBOLS ON
      # leading to a call to nvlink.  If we let this through (at least
      # in case of Celeritas) we would need to add the DEVICE_LINK options
      # also on non cuda libraries (that we detect depends on a cuda library).
      # Note: we might be able to move this to celeritas_target_link_libraries
      CUDA_RESOLVE_DEVICE_SYMBOLS OFF
    )
    if(NOT _target_type STREQUAL "EXECUTABLE")
      get_target_property(_current_runtime ${target} CUDA_RUNTIME_LIBRARY)
      if(NOT _current_runtime STREQUAL "Shared")
        set(_need_to_use_shared_runtime FALSE)
        foreach(_lib ${_alldependencies})
          celeritas_check_cuda_runtime(_runtime ${_lib})
          if(_runtime STREQUAL "Shared")
            set(_need_to_use_shared_runtime TRUE)
            break()
          endif()
        endforeach()
        # We do not yet treat the case where the dependent library is Static
        # and the current one is Shared.
        if(${_need_to_use_shared_runtime})
          set_target_properties(${target} PROPERTIES CUDA_RUNTIME_LIBRARY "Shared")
        endif()
      endif()
    endif()
  endif()

endfunction()

#-----------------------------------------------------------------------------#
#
# Return a flat list of all the direct and indirect dependencies of 'target'
# which are libraries containing CUDA separatable code.
#
function(celeritas_cuda_gather_dependencies outlist target)
  if(NOT TARGET ${target})
    return()
  endif()
  celeritas_strip_alias(target ${target})
  get_target_property(_target_type ${target} TYPE)
  if(NOT _target_type STREQUAL "INTERFACE_LIBRARY")
    get_target_property(_target_link_libraries ${target} LINK_LIBRARIES)
    if(_target_link_libraries)
      foreach(_lib ${_target_link_libraries})
        celeritas_strip_alias(_lib ${_lib})
        if(TARGET ${_lib})
          celeritas_get_library_middle_target(_libmid ${_lib})
        endif()
        if(TARGET ${_libmid})
          list(APPEND ${outlist} ${_libmid})
        endif()
        # and recurse
        celeritas_cuda_gather_dependencies(_midlist ${_lib})
        list(APPEND ${outlist} ${_midlist})
      endforeach()
    endif()
  endif()
  list(REMOVE_DUPLICATES ${outlist})
  set(${outlist} ${${outlist}} PARENT_SCOPE)
endfunction()

#-----------------------------------------------------------------------------#
********** CeleritasTargets.cmake ***********
# Generated by CMake

if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" LESS 2.8)
   message(FATAL_ERROR "CMake >= 2.8.0 required")
endif()
if(CMAKE_VERSION VERSION_LESS "2.8.3")
   message(FATAL_ERROR "CMake >= 2.8.3 required")
endif()
cmake_policy(PUSH)
cmake_policy(VERSION 2.8.3...3.22)
#----------------------------------------------------------------
# Generated CMake target import file.
#----------------------------------------------------------------

# Commands may need to know the format version.
set(CMAKE_IMPORT_FILE_VERSION 1)

# Protect against multiple inclusion, which would fail when already imported targets are added once more.
set(_cmake_targets_defined "")
set(_cmake_targets_not_defined "")
set(_cmake_expected_targets "")
foreach(_cmake_expected_target IN ITEMS Celeritas::celeritas_device_toolkit Celeritas::corecel Celeritas::orange Celeritas::celeritas_geant4 Celeritas::celeritas_hepmc Celeritas::celeritas Celeritas::accel Celeritas::testcel_harness Celeritas::testcel_core Celeritas::testcel_orange Celeritas::testcel_celeritas_core Celeritas::testcel_celeritas_geo Celeritas::testcel_celeritas Celeritas::testcel_accel Celeritas::orange-update Celeritas::celer-export-geant Celeritas::celer-dump-data Celeritas::celer-sim Celeritas::celer-g4 Celeritas::celeritas_demo_interactor)
  list(APPEND _cmake_expected_targets "${_cmake_expected_target}")
  if(TARGET "${_cmake_expected_target}")
    list(APPEND _cmake_targets_defined "${_cmake_expected_target}")
  else()
    list(APPEND _cmake_targets_not_defined "${_cmake_expected_target}")
  endif()
endforeach()
unset(_cmake_expected_target)
if(_cmake_targets_defined STREQUAL _cmake_expected_targets)
  unset(_cmake_targets_defined)
  unset(_cmake_targets_not_defined)
  unset(_cmake_expected_targets)
  unset(CMAKE_IMPORT_FILE_VERSION)
  cmake_policy(POP)
  return()
endif()
if(NOT _cmake_targets_defined STREQUAL "")
  string(REPLACE ";" ", " _cmake_targets_defined_text "${_cmake_targets_defined}")
  string(REPLACE ";" ", " _cmake_targets_not_defined_text "${_cmake_targets_not_defined}")
  message(FATAL_ERROR "Some (but not all) targets in this export set were already defined.\nTargets Defined: ${_cmake_targets_defined_text}\nTargets not yet defined: ${_cmake_targets_not_defined_text}\n")
endif()
unset(_cmake_targets_defined)
unset(_cmake_targets_not_defined)
unset(_cmake_expected_targets)


# Compute the installation prefix relative to this file.
get_filename_component(_IMPORT_PREFIX "${CMAKE_CURRENT_LIST_FILE}" PATH)
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
if(_IMPORT_PREFIX STREQUAL "/")
  set(_IMPORT_PREFIX "")
endif()

# Create imported target Celeritas::celeritas_device_toolkit
add_library(Celeritas::celeritas_device_toolkit INTERFACE IMPORTED)

set_target_properties(Celeritas::celeritas_device_toolkit PROPERTIES
  INTERFACE_INCLUDE_DIRECTORIES "/opt/rocm/include"
  INTERFACE_LINK_DIRECTORIES "/opt/rh/devtoolset-7/root/usr/lib/gcc/x86_64-redhat-linux/7;/opt/rh/devtoolset-7/root/usr/lib64;/lib64;/usr/lib64;/lib;/usr/lib;/opt/rocm/lib"
  INTERFACE_LINK_LIBRARIES "amdhip64;stdc++;m;gcc_s;gcc;c;gcc_s;gcc"
  INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "/opt/rocm/include"
)

# Create imported target Celeritas::corecel
add_library(Celeritas::corecel STATIC IMPORTED)

set_target_properties(Celeritas::corecel PROPERTIES
  INTERFACE_COMPILE_FEATURES "cxx_std_17"
  INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include"
  INTERFACE_LINK_LIBRARIES "\$<LINK_ONLY:Celeritas::celeritas_device_toolkit>;\$<LINK_ONLY:nlohmann_json::nlohmann_json>;\$<LINK_ONLY:OpenMP::OpenMP_CXX>"
)

# Create imported target Celeritas::orange
add_library(Celeritas::orange STATIC IMPORTED)

set_target_properties(Celeritas::orange PROPERTIES
  INTERFACE_LINK_LIBRARIES "\$<LINK_ONLY:nlohmann_json::nlohmann_json>;Celeritas::corecel"
)

# Create imported target Celeritas::celeritas_geant4
add_library(Celeritas::celeritas_geant4 INTERFACE IMPORTED)

set_target_properties(Celeritas::celeritas_geant4 PROPERTIES
  INTERFACE_LINK_LIBRARIES "\$<LINK_ONLY:Celeritas::corecel>;\$<LINK_ONLY:XercesC::XercesC>;\$<LINK_ONLY:Geant4::G4Tree>;\$<LINK_ONLY:Geant4::G4FR>;\$<LINK_ONLY:Geant4::G4GMocren>;\$<LINK_ONLY:Geant4::G4visHepRep>;\$<LINK_ONLY:Geant4::G4RayTracer>;\$<LINK_ONLY:Geant4::G4VRML>;\$<LINK_ONLY:Geant4::G4vis_management>;\$<LINK_ONLY:Geant4::G4modeling>;\$<LINK_ONLY:Geant4::G4interfaces>;\$<LINK_ONLY:Geant4::G4persistency>;\$<LINK_ONLY:Geant4::G4analysis>;\$<LINK_ONLY:Geant4::G4error_propagation>;\$<LINK_ONLY:Geant4::G4readout>;\$<LINK_ONLY:Geant4::G4physicslists>;\$<LINK_ONLY:Geant4::G4run>;\$<LINK_ONLY:Geant4::G4event>;\$<LINK_ONLY:Geant4::G4tasking>;\$<LINK_ONLY:Geant4::G4tracking>;\$<LINK_ONLY:Geant4::G4parmodels>;\$<LINK_ONLY:Geant4::G4processes>;\$<LINK_ONLY:Geant4::G4digits_hits>;\$<LINK_ONLY:Geant4::G4track>;\$<LINK_ONLY:Geant4::G4particles>;\$<LINK_ONLY:Geant4::G4geometry>;\$<LINK_ONLY:Geant4::G4materials>;\$<LINK_ONLY:Geant4::G4graphics_reps>;\$<LINK_ONLY:Geant4::G4intercoms>;\$<LINK_ONLY:Geant4::G4global>;\$<LINK_ONLY:Geant4::G4tools>;\$<LINK_ONLY:Geant4::G4ptl>;\$<LINK_ONLY:Geant4::G4UIVisDefinitions>"
)

# Create imported target Celeritas::celeritas_hepmc
add_library(Celeritas::celeritas_hepmc INTERFACE IMPORTED)

set_target_properties(Celeritas::celeritas_hepmc PROPERTIES
  INTERFACE_LINK_LIBRARIES "\$<LINK_ONLY:Celeritas::corecel>;\$<LINK_ONLY:HepMC3::HepMC3>"
)

# Create imported target Celeritas::celeritas
add_library(Celeritas::celeritas STATIC IMPORTED)

set_target_properties(Celeritas::celeritas PROPERTIES
  INTERFACE_LINK_LIBRARIES "\$<LINK_ONLY:Celeritas::celeritas_device_toolkit>;\$<LINK_ONLY:Celeritas::celeritas_geant4>;\$<LINK_ONLY:Celeritas::celeritas_hepmc>;\$<LINK_ONLY:nlohmann_json::nlohmann_json>;\$<LINK_ONLY:OpenMP::OpenMP_CXX>;Celeritas::corecel;Celeritas::orange"
)

# Create imported target Celeritas::accel
add_library(Celeritas::accel STATIC IMPORTED)

set_target_properties(Celeritas::accel PROPERTIES
  INTERFACE_LINK_LIBRARIES "\$<LINK_ONLY:nlohmann_json::nlohmann_json>;\$<LINK_ONLY:HepMC3::HepMC3>;\$<LINK_ONLY:OpenMP::OpenMP_CXX>;Celeritas::celeritas;Celeritas::corecel;Geant4::G4Tree;Geant4::G4FR;Geant4::G4GMocren;Geant4::G4visHepRep;Geant4::G4RayTracer;Geant4::G4VRML;Geant4::G4vis_management;Geant4::G4modeling;Geant4::G4interfaces;Geant4::G4persistency;Geant4::G4analysis;Geant4::G4error_propagation;Geant4::G4readout;Geant4::G4physicslists;Geant4::G4run;Geant4::G4event;Geant4::G4tasking;Geant4::G4tracking;Geant4::G4parmodels;Geant4::G4processes;Geant4::G4digits_hits;Geant4::G4track;Geant4::G4particles;Geant4::G4geometry;Geant4::G4materials;Geant4::G4graphics_reps;Geant4::G4intercoms;Geant4::G4global;Geant4::G4tools;Geant4::G4ptl;Geant4::G4UIVisDefinitions"
)

# Create imported target Celeritas::testcel_harness
add_library(Celeritas::testcel_harness STATIC IMPORTED)

set_target_properties(Celeritas::testcel_harness PROPERTIES
  INTERFACE_COMPILE_FEATURES "cxx_std_14"
  INTERFACE_LINK_LIBRARIES "Celeritas::corecel;GTest::GTest;\$<LINK_ONLY:nlohmann_json::nlohmann_json>"
)

# Create imported target Celeritas::testcel_core
add_library(Celeritas::testcel_core STATIC IMPORTED)

set_target_properties(Celeritas::testcel_core PROPERTIES
  INTERFACE_LINK_LIBRARIES "\$<LINK_ONLY:Celeritas::testcel_harness>;\$<LINK_ONLY:Celeritas::corecel>"
)

# Create imported target Celeritas::testcel_orange
add_library(Celeritas::testcel_orange STATIC IMPORTED)

set_target_properties(Celeritas::testcel_orange PROPERTIES
  INTERFACE_LINK_LIBRARIES "\$<LINK_ONLY:Celeritas::testcel_harness>;\$<LINK_ONLY:Celeritas::testcel_core>;\$<LINK_ONLY:Celeritas::orange>"
)

# Create imported target Celeritas::testcel_celeritas_core
add_library(Celeritas::testcel_celeritas_core INTERFACE IMPORTED)

set_target_properties(Celeritas::testcel_celeritas_core PROPERTIES
  INTERFACE_LINK_LIBRARIES "\$<LINK_ONLY:Celeritas::testcel_core>;\$<LINK_ONLY:Celeritas::testcel_harness>;\$<LINK_ONLY:Celeritas::celeritas>;\$<LINK_ONLY:nlohmann_json::nlohmann_json>"
)

# Create imported target Celeritas::testcel_celeritas_geo
add_library(Celeritas::testcel_celeritas_geo INTERFACE IMPORTED)

set_target_properties(Celeritas::testcel_celeritas_geo PROPERTIES
  INTERFACE_LINK_LIBRARIES "\$<LINK_ONLY:Celeritas::testcel_harness>;\$<LINK_ONLY:Celeritas::celeritas>;\$<LINK_ONLY:Celeritas::orange>;\$<LINK_ONLY:Geant4::G4Tree>;\$<LINK_ONLY:Geant4::G4FR>;\$<LINK_ONLY:Geant4::G4GMocren>;\$<LINK_ONLY:Geant4::G4visHepRep>;\$<LINK_ONLY:Geant4::G4RayTracer>;\$<LINK_ONLY:Geant4::G4VRML>;\$<LINK_ONLY:Geant4::G4vis_management>;\$<LINK_ONLY:Geant4::G4modeling>;\$<LINK_ONLY:Geant4::G4interfaces>;\$<LINK_ONLY:Geant4::G4persistency>;\$<LINK_ONLY:Geant4::G4analysis>;\$<LINK_ONLY:Geant4::G4error_propagation>;\$<LINK_ONLY:Geant4::G4readout>;\$<LINK_ONLY:Geant4::G4physicslists>;\$<LINK_ONLY:Geant4::G4run>;\$<LINK_ONLY:Geant4::G4event>;\$<LINK_ONLY:Geant4::G4tasking>;\$<LINK_ONLY:Geant4::G4tracking>;\$<LINK_ONLY:Geant4::G4parmodels>;\$<LINK_ONLY:Geant4::G4processes>;\$<LINK_ONLY:Geant4::G4digits_hits>;\$<LINK_ONLY:Geant4::G4track>;\$<LINK_ONLY:Geant4::G4particles>;\$<LINK_ONLY:Geant4::G4geometry>;\$<LINK_ONLY:Geant4::G4materials>;\$<LINK_ONLY:Geant4::G4graphics_reps>;\$<LINK_ONLY:Geant4::G4intercoms>;\$<LINK_ONLY:Geant4::G4global>;\$<LINK_ONLY:Geant4::G4tools>;\$<LINK_ONLY:Geant4::G4ptl>;\$<LINK_ONLY:Geant4::G4UIVisDefinitions>"
)

# Create imported target Celeritas::testcel_celeritas
add_library(Celeritas::testcel_celeritas STATIC IMPORTED)

set_target_properties(Celeritas::testcel_celeritas PROPERTIES
  INTERFACE_LINK_LIBRARIES "\$<LINK_ONLY:Celeritas::testcel_core>;\$<LINK_ONLY:Celeritas::testcel_harness>;\$<LINK_ONLY:Celeritas::celeritas>;\$<LINK_ONLY:nlohmann_json::nlohmann_json>;\$<LINK_ONLY:Celeritas::orange>;\$<LINK_ONLY:Geant4::G4Tree>;\$<LINK_ONLY:Geant4::G4FR>;\$<LINK_ONLY:Geant4::G4GMocren>;\$<LINK_ONLY:Geant4::G4visHepRep>;\$<LINK_ONLY:Geant4::G4RayTracer>;\$<LINK_ONLY:Geant4::G4VRML>;\$<LINK_ONLY:Geant4::G4vis_management>;\$<LINK_ONLY:Geant4::G4modeling>;\$<LINK_ONLY:Geant4::G4interfaces>;\$<LINK_ONLY:Geant4::G4persistency>;\$<LINK_ONLY:Geant4::G4analysis>;\$<LINK_ONLY:Geant4::G4error_propagation>;\$<LINK_ONLY:Geant4::G4readout>;\$<LINK_ONLY:Geant4::G4physicslists>;\$<LINK_ONLY:Geant4::G4run>;\$<LINK_ONLY:Geant4::G4event>;\$<LINK_ONLY:Geant4::G4tasking>;\$<LINK_ONLY:Geant4::G4tracking>;\$<LINK_ONLY:Geant4::G4parmodels>;\$<LINK_ONLY:Geant4::G4processes>;\$<LINK_ONLY:Geant4::G4digits_hits>;\$<LINK_ONLY:Geant4::G4track>;\$<LINK_ONLY:Geant4::G4particles>;\$<LINK_ONLY:Geant4::G4geometry>;\$<LINK_ONLY:Geant4::G4materials>;\$<LINK_ONLY:Geant4::G4graphics_reps>;\$<LINK_ONLY:Geant4::G4intercoms>;\$<LINK_ONLY:Geant4::G4global>;\$<LINK_ONLY:Geant4::G4tools>;\$<LINK_ONLY:Geant4::G4ptl>;\$<LINK_ONLY:Geant4::G4UIVisDefinitions>"
)

# Create imported target Celeritas::testcel_accel
add_library(Celeritas::testcel_accel STATIC IMPORTED)

set_target_properties(Celeritas::testcel_accel PROPERTIES
  INTERFACE_LINK_LIBRARIES "Celeritas::testcel_celeritas;Celeritas::testcel_core;Celeritas::testcel_harness;Celeritas::accel"
)

# Create imported target Celeritas::orange-update
add_executable(Celeritas::orange-update IMPORTED)

# Create imported target Celeritas::celer-export-geant
add_executable(Celeritas::celer-export-geant IMPORTED)

# Create imported target Celeritas::celer-dump-data
add_executable(Celeritas::celer-dump-data IMPORTED)

# Create imported target Celeritas::celer-sim
add_executable(Celeritas::celer-sim IMPORTED)

# Create imported target Celeritas::celer-g4
add_executable(Celeritas::celer-g4 IMPORTED)

# Create imported target Celeritas::celeritas_demo_interactor
add_library(Celeritas::celeritas_demo_interactor STATIC IMPORTED)

set_target_properties(Celeritas::celeritas_demo_interactor PROPERTIES
  INTERFACE_LINK_LIBRARIES "Celeritas::celeritas;nlohmann_json::nlohmann_json"
)

if(CMAKE_VERSION VERSION_LESS 3.0.0)
  message(FATAL_ERROR "This file relies on consumers using CMake 3.0.0 or greater.")
endif()

# Load information for each installed configuration.
file(GLOB _cmake_config_files "${CMAKE_CURRENT_LIST_DIR}/CeleritasTargets-*.cmake")
foreach(_cmake_config_file IN LISTS _cmake_config_files)
  include("${_cmake_config_file}")
endforeach()
unset(_cmake_config_file)
unset(_cmake_config_files)

# Cleanup temporary variables.
set(_IMPORT_PREFIX)

# Loop over all imported files and verify that they actually exist
foreach(_cmake_target IN LISTS _cmake_import_check_targets)
  foreach(_cmake_file IN LISTS "_cmake_import_check_files_for_${_cmake_target}")
    if(NOT EXISTS "${_cmake_file}")
      message(FATAL_ERROR "The imported target \"${_cmake_target}\" references the file
   \"${_cmake_file}\"
but this file does not exist.  Possible reasons include:
* The file was deleted, renamed, or moved to another location.
* An install or uninstall procedure did not complete successfully.
* The installation package was faulty and contained
   \"${CMAKE_CURRENT_LIST_FILE}\"
but not all the files it references.
")
    endif()
  endforeach()
  unset(_cmake_file)
  unset("_cmake_import_check_files_for_${_cmake_target}")
endforeach()
unset(_cmake_target)
unset(_cmake_import_check_targets)

# This file does not depend on other imported targets which have
# been exported from the same project but in a separate export set.

# Commands beyond this point should not need to know the version.
set(CMAKE_IMPORT_FILE_VERSION)
cmake_policy(POP)
********** CeleritasTargets-release.cmake ***********
#----------------------------------------------------------------
# Generated CMake target import file for configuration "Release".
#----------------------------------------------------------------

# Commands may need to know the format version.
set(CMAKE_IMPORT_FILE_VERSION 1)

# Import target "Celeritas::corecel" for configuration "Release"
set_property(TARGET Celeritas::corecel APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
set_target_properties(Celeritas::corecel PROPERTIES
  IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "CXX;HIP"
  IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/lib64/libcorecel.a"
  )

list(APPEND _cmake_import_check_targets Celeritas::corecel )
list(APPEND _cmake_import_check_files_for_Celeritas::corecel "${_IMPORT_PREFIX}/lib64/libcorecel.a" )

# Import target "Celeritas::orange" for configuration "Release"
set_property(TARGET Celeritas::orange APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
set_target_properties(Celeritas::orange PROPERTIES
  IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "CXX"
  IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/lib64/liborange.a"
  )

list(APPEND _cmake_import_check_targets Celeritas::orange )
list(APPEND _cmake_import_check_files_for_Celeritas::orange "${_IMPORT_PREFIX}/lib64/liborange.a" )

# Import target "Celeritas::celeritas" for configuration "Release"
set_property(TARGET Celeritas::celeritas APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
set_target_properties(Celeritas::celeritas PROPERTIES
  IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "CXX;HIP"
  IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/lib64/libceleritas.a"
  )

list(APPEND _cmake_import_check_targets Celeritas::celeritas )
list(APPEND _cmake_import_check_files_for_Celeritas::celeritas "${_IMPORT_PREFIX}/lib64/libceleritas.a" )

# Import target "Celeritas::accel" for configuration "Release"
set_property(TARGET Celeritas::accel APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
set_target_properties(Celeritas::accel PROPERTIES
  IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "CXX;HIP"
  IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/lib64/libaccel.a"
  )

list(APPEND _cmake_import_check_targets Celeritas::accel )
list(APPEND _cmake_import_check_files_for_Celeritas::accel "${_IMPORT_PREFIX}/lib64/libaccel.a" )

# Import target "Celeritas::testcel_harness" for configuration "Release"
set_property(TARGET Celeritas::testcel_harness APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
set_target_properties(Celeritas::testcel_harness PROPERTIES
  IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "CXX"
  IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/lib64/libtestcel_harness.a"
  )

list(APPEND _cmake_import_check_targets Celeritas::testcel_harness )
list(APPEND _cmake_import_check_files_for_Celeritas::testcel_harness "${_IMPORT_PREFIX}/lib64/libtestcel_harness.a" )

# Import target "Celeritas::testcel_core" for configuration "Release"
set_property(TARGET Celeritas::testcel_core APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
set_target_properties(Celeritas::testcel_core PROPERTIES
  IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "CXX"
  IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/lib64/libtestcel_core.a"
  )

list(APPEND _cmake_import_check_targets Celeritas::testcel_core )
list(APPEND _cmake_import_check_files_for_Celeritas::testcel_core "${_IMPORT_PREFIX}/lib64/libtestcel_core.a" )

# Import target "Celeritas::testcel_orange" for configuration "Release"
set_property(TARGET Celeritas::testcel_orange APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
set_target_properties(Celeritas::testcel_orange PROPERTIES
  IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "CXX"
  IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/lib64/libtestcel_orange.a"
  )

list(APPEND _cmake_import_check_targets Celeritas::testcel_orange )
list(APPEND _cmake_import_check_files_for_Celeritas::testcel_orange "${_IMPORT_PREFIX}/lib64/libtestcel_orange.a" )

# Import target "Celeritas::testcel_celeritas" for configuration "Release"
set_property(TARGET Celeritas::testcel_celeritas APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
set_target_properties(Celeritas::testcel_celeritas PROPERTIES
  IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "CXX"
  IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/lib64/libtestcel_celeritas.a"
  )

list(APPEND _cmake_import_check_targets Celeritas::testcel_celeritas )
list(APPEND _cmake_import_check_files_for_Celeritas::testcel_celeritas "${_IMPORT_PREFIX}/lib64/libtestcel_celeritas.a" )

# Import target "Celeritas::testcel_accel" for configuration "Release"
set_property(TARGET Celeritas::testcel_accel APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
set_target_properties(Celeritas::testcel_accel PROPERTIES
  IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "CXX"
  IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/lib64/libtestcel_accel.a"
  )

list(APPEND _cmake_import_check_targets Celeritas::testcel_accel )
list(APPEND _cmake_import_check_files_for_Celeritas::testcel_accel "${_IMPORT_PREFIX}/lib64/libtestcel_accel.a" )

# Import target "Celeritas::orange-update" for configuration "Release"
set_property(TARGET Celeritas::orange-update APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
set_target_properties(Celeritas::orange-update PROPERTIES
  IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/bin/orange-update"
  )

list(APPEND _cmake_import_check_targets Celeritas::orange-update )
list(APPEND _cmake_import_check_files_for_Celeritas::orange-update "${_IMPORT_PREFIX}/bin/orange-update" )

# Import target "Celeritas::celer-export-geant" for configuration "Release"
set_property(TARGET Celeritas::celer-export-geant APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
set_target_properties(Celeritas::celer-export-geant PROPERTIES
  IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/bin/celer-export-geant"
  )

list(APPEND _cmake_import_check_targets Celeritas::celer-export-geant )
list(APPEND _cmake_import_check_files_for_Celeritas::celer-export-geant "${_IMPORT_PREFIX}/bin/celer-export-geant" )

# Import target "Celeritas::celer-dump-data" for configuration "Release"
set_property(TARGET Celeritas::celer-dump-data APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
set_target_properties(Celeritas::celer-dump-data PROPERTIES
  IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/bin/celer-dump-data"
  )

list(APPEND _cmake_import_check_targets Celeritas::celer-dump-data )
list(APPEND _cmake_import_check_files_for_Celeritas::celer-dump-data "${_IMPORT_PREFIX}/bin/celer-dump-data" )

# Import target "Celeritas::celer-sim" for configuration "Release"
set_property(TARGET Celeritas::celer-sim APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
set_target_properties(Celeritas::celer-sim PROPERTIES
  IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/bin/celer-sim"
  )

list(APPEND _cmake_import_check_targets Celeritas::celer-sim )
list(APPEND _cmake_import_check_files_for_Celeritas::celer-sim "${_IMPORT_PREFIX}/bin/celer-sim" )

# Import target "Celeritas::celer-g4" for configuration "Release"
set_property(TARGET Celeritas::celer-g4 APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
set_target_properties(Celeritas::celer-g4 PROPERTIES
  IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/bin/celer-g4"
  )

list(APPEND _cmake_import_check_targets Celeritas::celer-g4 )
list(APPEND _cmake_import_check_files_for_Celeritas::celer-g4 "${_IMPORT_PREFIX}/bin/celer-g4" )

# Import target "Celeritas::celeritas_demo_interactor" for configuration "Release"
set_property(TARGET Celeritas::celeritas_demo_interactor APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
set_target_properties(Celeritas::celeritas_demo_interactor PROPERTIES
  IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "CXX"
  IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/lib64/libceleritas_demo_interactor.a"
  )

list(APPEND _cmake_import_check_targets Celeritas::celeritas_demo_interactor )
list(APPEND _cmake_import_check_files_for_Celeritas::celeritas_demo_interactor "${_IMPORT_PREFIX}/lib64/libceleritas_demo_interactor.a" )

# Commands beyond this point should not need to know the version.
set(CMAKE_IMPORT_FILE_VERSION)
-- The CXX compiler identification is GNU 7.3.1
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /opt/rh/devtoolset-7/root/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- The HIP compiler identification is Clang 15.0.0
-- Detecting HIP compiler ABI info
-- Detecting HIP compiler ABI info - done
-- Check for working HIP compiler: /opt/rocm/llvm/bin/clang++ - skipped
-- Detecting HIP compile features
-- Detecting HIP compile features - done
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Check if compiler accepts -pthread
-- Check if compiler accepts -pthread - yes
-- Found Threads: TRUE  
-- Found Celeritas: /var/jenkins/workspace/celeritas_PR-1042/install/lib64/cmake/Celeritas/CeleritasConfig.cmake (found suitable version "0.5.0", minimum required is "0.5") 
-- Configuring done
-- Generating done
-- Build files have been written to: /var/jenkins/workspace/celeritas_PR-1042/example/minimal/build
[1/2] Building CXX object CMakeFiles/minimal.dir/minimal.cc.o
[2/2] Linking HIP executable minimal
FAILED: minimal 
: && /opt/rocm/llvm/bin/clang++ --offload-arch=gfx908 --offload-arch=gfx908 -Wl,-rpath=/opt/rh/devtoolset-7/root/usr/lib64 -Wl,-rpath=/opt/rh/devtoolset-7/root/usr/lib CMakeFiles/minimal.dir/minimal.cc.o -o minimal -L/opt/rh/devtoolset-7/root/usr/lib -Wl,-rpath,/opt/view/lib64:/opt/software/linux-centos7-x86_64/gcc-7.3.1/xerces-c-3.2.3-gysfmqaecsrbi3n7jm2y6ks433sjyna5/lib:/opt/software/linux-centos7-x86_64/gcc-7.3.1/zlib-1.2.13-ehffwlghderw6l746zya3bawdhcgfnvr/lib:/opt/software/linux-centos7-x86_64/gcc-7.3.1/expat-2.4.8-r4afp64rtmzbxklnlkkjeleaibl665yk/lib:/opt/software/linux-centos7-x86_64/gcc-7.3.1/clhep-2.4.6.0-7kz2najh4o6e5nbrji7wlqj4dlo2nrxy/lib  /var/jenkins/workspace/celeritas_PR-1042/install/lib64/libceleritas.a  /opt/view/lib64/libG4Tree.so  /opt/view/lib64/libG4FR.so  /opt/view/lib64/libG4GMocren.so  /opt/view/lib64/libG4visHepRep.so  /opt/view/lib64/libG4RayTracer.so  /opt/view/lib64/libG4VRML.so  /opt/view/lib64/libG4vis_management.so  /opt/view/lib64/libG4modeling.so  /opt/view/lib64/libG4interfaces.so  /opt/view/lib64/libG4persistency.so  /opt/software/linux-centos7-x86_64/gcc-7.3.1/xerces-c-3.2.3-gysfmqaecsrbi3n7jm2y6ks433sjyna5/lib/libxerces-c.so  /opt/view/lib64/libG4error_propagation.so  /opt/view/lib64/libG4readout.so  /opt/view/lib64/libG4physicslists.so  /opt/view/lib64/libG4tasking.so  /opt/view/lib64/libG4run.so  /opt/view/lib64/libG4event.so  /opt/view/lib64/libG4tracking.so  /opt/view/lib64/libG4parmodels.so  /opt/view/lib64/libG4processes.so  /opt/view/lib64/libG4analysis.so  /opt/software/linux-centos7-x86_64/gcc-7.3.1/zlib-1.2.13-ehffwlghderw6l746zya3bawdhcgfnvr/lib/libz.so  /opt/software/linux-centos7-x86_64/gcc-7.3.1/expat-2.4.8-r4afp64rtmzbxklnlkkjeleaibl665yk/lib/libexpat.so  /opt/view/lib64/libG4digits_hits.so  /opt/view/lib64/libG4track.so  /opt/view/lib64/libG4particles.so  /opt/view/lib64/libG4geometry.so  /opt/view/lib64/libG4materials.so  /opt/view/lib64/libG4graphics_reps.so  /opt/view/lib64/libG4intercoms.so  /opt/view/lib64/libG4global.so  /opt/software/linux-centos7-x86_64/gcc-7.3.1/clhep-2.4.6.0-7kz2najh4o6e5nbrji7wlqj4dlo2nrxy/lib/libCLHEP-2.4.6.0.so  -lstdc++fs  /opt/view/lib64/libG4tools.so  /opt/view/lib64/libG4ptl.so.0.0.2  -pthread  /opt/view/lib64/libHepMC3.so  /var/jenkins/workspace/celeritas_PR-1042/install/lib64/liborange.a  /var/jenkins/workspace/celeritas_PR-1042/install/lib64/libcorecel.a  -lamdhip64  -lstdc++  -lm  -lgcc_s  -lgcc  -lc  -lgcc_s  -lgcc  -lc  -lgomp  -lpthread && :
clang-15: warning: argument unused during compilation: '--offload-arch=gfx908' [-Wunused-command-line-argument]
clang-15: warning: argument unused during compilation: '--offload-arch=gfx908' [-Wunused-command-line-argument]
ld.lld: error: unable to find library -lamdhip64
clang-15: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.
Post stage
[Pipeline] xunit
INFO: Processing CTest-Version 3.x (default)
[Pipeline] }
$ docker stop --time=1 a4110de85f0216748fbcb7d5823da741cd9b6a37d077a370f10dc2ddddd18ead
INFO: [CTest-Version 3.x (default)] - 1 test report file(s) were found with the pattern 'build/Testing/**/*.xml' relative to '/var/jenkins/workspace/celeritas_PR-1042' for the testing framework 'CTest-Version 3.x (default)'.
$ docker rm -f --volumes a4110de85f0216748fbcb7d5823da741cd9b6a37d077a370f10dc2ddddd18ead
[Pipeline] // withDockerContainer
[Pipeline] }
[Pipeline] // withEnv
[Pipeline] }
[Pipeline] // node
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
Failed in branch rocm-ndebug-orange
[Pipeline] // parallel
[Pipeline] }
[Pipeline] // stage
[Pipeline] End of Pipeline
ERROR: script returned exit code 1

GitHub has been notified of this commit’s build result

Finished: FAILURE