[PATCH] D150884: depdendent projects fail to build with cmake 3.25 and llvm 16-rc4

Marcelo Juchem via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 18 09:52:37 PDT 2023


juchem created this revision.
juchem added reviewers: Eugene.Zelenko, tstellar, bkramer, MaskRay.
Herald added a project: All.
juchem requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

closes https://github.com/llvm/llvm-project/issues/61436

When building [latest `iovisor/bcc`](https://github.com/iovisor/bcc/commit/1ea0390725391e76256af6a4d0eb857816e6290f), `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`.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D150884

Files:
  llvm/cmake/modules/LLVM-Config.cmake


Index: llvm/cmake/modules/LLVM-Config.cmake
===================================================================
--- llvm/cmake/modules/LLVM-Config.cmake
+++ llvm/cmake/modules/LLVM-Config.cmake
@@ -1,3 +1,6 @@
+cmake_policy(PUSH)
+cmake_policy(SET CMP0057 NEW)
+
 function(get_system_libs return_var)
   message(AUTHOR_WARNING "get_system_libs no longer needed")
   set(${return_var} "" PARENT_SCOPE)
@@ -343,3 +346,5 @@
   endforeach(c)
   set(${out_libs} ${result} PARENT_SCOPE)
 endfunction(explicit_map_components_to_libraries)
+
+cmake_policy(POP)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D150884.523415.patch
Type: text/x-patch
Size: 553 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230518/aadb39b0/attachment.bin>


More information about the llvm-commits mailing list