Author: Joshua Batista
Date: 2026-05-22T14:35:44-07:00
New Revision: ff83218ec11bafbcc1e0e788917765e681cec809

URL: 
https://github.com/llvm/llvm-project/commit/ff83218ec11bafbcc1e0e788917765e681cec809
DIFF: 
https://github.com/llvm/llvm-project/commit/ff83218ec11bafbcc1e0e788917765e681cec809.diff

LOG: [HLSL] Fix improper parsing of IN_LIST within if condition (#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.


Fixes https://github.com/llvm/llvm-project/issues/199282
Assisted by: Github Copilot

Added: 
    

Modified: 
    clang/cmake/caches/HLSL.cmake

Removed: 
    


################################################################################
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