if(DETECT_KOKKOS_OPTS)
  return()
endif()
set(DETECT_KOKKOS_OPTS true)

function(detect_kokkos_opts)
  if (Kokkos_FOUND)
    list(FIND Kokkos_DEVICES SERIAL serial_index)
    list(FIND Kokkos_DEVICES OPENMP openmp_index)
    list(FIND Kokkos_DEVICES CUDA cuda_index)
    if (NOT cuda_index EQUAL -1)
      message(STATUS "Kokkos has CUDA")
      set(Kokkos_HAS_CUDA TRUE PARENT_SCOPE)
      set(Kokkos_HAS_CUDA_LAMBDA TRUE PARENT_SCOPE)
    endif()
    if (NOT openmp_index EQUAL -1)
      message(STATUS "Kokkos has OpenMP")
      set(Kokkos_HAS_OpenMP TRUE PARENT_SCOPE)
    endif()
    set(Kokkos_HAS_Profiling TRUE PARENT_SCOPE)
  endif()
endfunction(detect_kokkos_opts)
