def METHOD_NAME(spec):
    targets = spec.variants["targets"].value
    llvm_targets = set()
    # Convert targets variant values to CMake LLVM_TARGETS_TO_BUILD array.
    spack_to_cmake = {
        "aarch64": "AARCH64",
        "amdgpu": "AMDGPU",
        "arm": "ARM",
        "hexagon": "HEXAGON",
        "nvptx": "NVPTX",
        "powerpc": "POWERPC",
        "riscv": "RISCV",
        "webassembly": "WEBASSEMBLY",
        "x86": "X86",
    }
    for t in targets:
        llvm_targets.add((spack_to_cmake[t], True))
    if spec.target.family in ("x86", "x86_64"):
        llvm_targets.add(("X86", True))
    elif spec.target.family == "arm":
        llvm_targets.add(("ARM", True))
    elif spec.target.family == "aarch64":
        llvm_targets.add(("AARCH64", True))
    elif spec.target.family in ("ppc64", "ppc64le", "ppc", "ppcle"):
        llvm_targets.add(("POWERPC", True))
    # for everything not represented, we add False
    for v in spack_to_cmake.values():
        if (v, True) not in llvm_targets:
            llvm_targets.add((v, False))
    return list(llvm_targets)