diff --git a/lib/spack/spack/compilers/msvc.py b/lib/spack/spack/compilers/msvc.py index cba2b6e41c..d34ef83c3e 100644 --- a/lib/spack/spack/compilers/msvc.py +++ b/lib/spack/spack/compilers/msvc.py @@ -199,7 +199,7 @@ def __init__(self, *args, **kwargs): # for a fortran compiler if paths[2]: # If this found, it sets all the vars - oneapi_root = os.getenv("ONEAPI_ROOT") + oneapi_root = os.path.join(self.cc, "../../..") oneapi_root_setvars = os.path.join(oneapi_root, "setvars.bat") oneapi_version_setvars = os.path.join( oneapi_root, "compiler", str(self.ifx_version), "env", "vars.bat"