From 6afe002c94301bc6c34b2aca9cec08114137b309 Mon Sep 17 00:00:00 2001
From: Stephen Nicholas Swatman <stephen@v25.nl>
Date: Wed, 19 Feb 2025 15:54:47 +0100
Subject: [PATCH] vecmem: fix SYCL compiler specification (#49108)

This commit adds an additional requirement to the vecmem package,
requiring the OneAPI compiler iff the `sycl` variant is turned on. This
allows us to correctly set the non-standard `SYCLCXX` environment
variable.
---
 var/spack/repos/builtin/packages/vecmem/package.py | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/var/spack/repos/builtin/packages/vecmem/package.py b/var/spack/repos/builtin/packages/vecmem/package.py
index 67ba53e95e6..c146f3ee3cd 100644
--- a/var/spack/repos/builtin/packages/vecmem/package.py
+++ b/var/spack/repos/builtin/packages/vecmem/package.py
@@ -67,6 +67,11 @@ class Vecmem(CMakePackage, CudaPackage):
     depends_on("hip", when="+hip")
     depends_on("sycl", when="+sycl")
 
+    # NOTE: this package uses a non-standard "SYCLCXX" environment variable which we can
+    # set easily only by requiring the OneAPI compiler, as this is automatically capable
+    # of compiling SYCL code.
+    requires("%oneapi", when="+sycl")
+
     # FIXME: due to #29447, googletest is not available to cmake when building with --test,
     # and we can choose between always depending on googletest, or using FetchContent
     # depends_on("googletest", type="test")
-- 
GitLab