[PATCH] D142405: [CMake] Replace list(FIND) by if(IN_LIST) where index isn't used

Aaron Puchert via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 25 16:05:55 PST 2023


aaronpuchert added a comment.

@beanz, a configuration error caused by this in a third-party project has been reported to me:

  CMake Warning (dev) at /usr/lib/llvm-16/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):
    clang_delta/CMakeLists.txt:465 (llvm_map_components_to_libnames)
  This warning is for project developers.  Use -Wno-dev to suppress it.
  
  CMake Error at /usr/lib/llvm-16/lib/cmake/llvm/LLVM-Config.cmake:230 (if):
    if given arguments:
  
      "engine" "IN_LIST" "link_components"

The project has `cmake_minimum_required(VERSION 2.8.12)` and is now running afoul CMP0057 <https://cmake.org/cmake/help/latest/policy/CMP0057.html>:

> CMake 3.3 adds support for the new IN_LIST operator.
>
> The `OLD` behavior for this policy is to ignore the IN_LIST operator. The `NEW` behavior is to interpret the IN_LIST operator.
>
> This policy was introduced in CMake version 3.3. CMake version 3.25.2 warns when the policy is not set and uses `OLD` behavior. Use the `cmake_policy()` command to set it to `OLD` or `NEW` explicitly.

This doesn't affect us internally because we have `cmake_minimum_required(VERSION 3.13.4)`, but should we add `cmake_policy(SET CMP0057 NEW)` to the exported files? Perhaps in a `PUSH`/`POP`?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D142405/new/

https://reviews.llvm.org/D142405



More information about the llvm-commits mailing list