https://github.com/bob80905 created 
https://github.com/llvm/llvm-project/pull/199276

Cmake does not properly parse IN_LIST within the if condition, and treats it as 
a token.
This is not desired behavior.
The CMP0057 policy supports the new [if() IN_LIST 
](https://cmake.org/cmake/help/latest/command/if.html#command:if) operator.
Enable this policy and resolve the build error.

Assisted by: Github Copilot

>From 4c4bf81ff475e7410341600b194794effda2ec3d Mon Sep 17 00:00:00 2001
From: Joshua Batista <[email protected]>
Date: Fri, 22 May 2026 13:14:51 -0700
Subject: [PATCH] add policy

---
 clang/cmake/caches/HLSL.cmake | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/clang/cmake/caches/HLSL.cmake b/clang/cmake/caches/HLSL.cmake
index 66e99a29454f0..40e92fd37382b 100644
--- a/clang/cmake/caches/HLSL.cmake
+++ b/clang/cmake/caches/HLSL.cmake
@@ -21,6 +21,10 @@ endif()
 # (docs/offload-distribution.md) for setup, prerequisites, and run
 # instructions.
 if (HLSL_ENABLE_OFFLOAD_DISTRIBUTION)
+  # Cache scripts run before the project's cmake_minimum_required takes
+  # effect, so CMP0057 still defaults to OLD here and IN_LIST would be
+  # parsed as a literal token. Opt in explicitly so the check below works.
+  cmake_policy(SET CMP0057 NEW)
   if (NOT "OffloadTest" IN_LIST LLVM_EXTERNAL_PROJECTS)
     message(FATAL_ERROR
       "HLSL_ENABLE_OFFLOAD_DISTRIBUTION requires OffloadTest to be enabled "

_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to