Skip to content

Commit 75a0502

Browse files
juchemthesamesam
authored andcommitted
[CMake] Set compatibility policy for lists in LLVM-Config.cmake.
Fixes "dependent projects fail to build with cmake 3.25 and llvm 16-rc4". When building [latest `iovisor/bcc`](iovisor/bcc@1ea0390), `cmake` complains about a change in the behavior of operator `IN_LIST`: ```console CMake Warning (dev) at /usr/local/lib/cmake/llvm/LLVM-Config.cmake:230 (if): Policy CMP0057 is not set: Support new IN_LIST if() operator. Run "cmake --help-policy CMP0057" for policy details. Use the cmake_policy command to set the policy and suppress this warning. IN_LIST will be interpreted as an operator when the policy is set to NEW. Since the policy is not set the OLD behavior will be used. Call Stack (most recent call first): cmake/clang_libs.cmake:32 (llvm_map_components_to_libnames) src/cc/CMakeLists.txt:132 (include) This warning is for project developers. Use -Wno-dev to suppress it. CMake Error at /usr/local/lib/cmake/llvm/LLVM-Config.cmake:230 (if): if given arguments: "engine" "IN_LIST" "link_components" Unknown arguments specified Call Stack (most recent call first): cmake/clang_libs.cmake:32 (llvm_map_components_to_libnames) src/cc/CMakeLists.txt:132 (include) ``` This patch addresses this issue by setting the aforementioned policy in `LLVM-Config.cmake`. Reviewed By: mgorny, thesamesam Differential Revision: https://reviews.llvm.org/D150884 Closes: #61436
1 parent 3d05ab6 commit 75a0502

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

llvm/cmake/modules/LLVM-Config.cmake

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
cmake_policy(PUSH)
2+
cmake_policy(SET CMP0057 NEW)
3+
14
function(get_system_libs return_var)
25
message(AUTHOR_WARNING "get_system_libs no longer needed")
36
set(${return_var} "" PARENT_SCOPE)
@@ -343,3 +346,5 @@ function(explicit_map_components_to_libraries out_libs)
343346
endforeach(c)
344347
set(${out_libs} ${result} PARENT_SCOPE)
345348
endfunction(explicit_map_components_to_libraries)
349+
350+
cmake_policy(POP)

0 commit comments

Comments
 (0)