Set cmake policy for CMP0057
authorYonghong Song <yhs@fb.com>
Sun, 26 Mar 2023 19:38:18 +0000 (12:38 -0700)
committerKarol Lewandowski <k.lewandowsk@samsung.com>
Thu, 22 Feb 2024 14:17:55 +0000 (15:17 +0100)
commita791fd102d851557476ceff6a0373ce9ffadae91
tree501b763fc531e205e85d3cabdc45e50076d4da4d
parent05997750960ff762fa40a4364b8a2c65e60a758a
Set cmake policy for CMP0057

With latest llvm17, running cmake, we got the following errors:
  -- Found LLVM: /home/yhs/work/llvm-project/llvm/build/install/include 17.0.0git (Use LLVM_ROOT envronment variable for another version of LLVM)
  CMake Warning (dev) at /home/yhs/work/llvm-project/llvm/build/install/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 /home/yhs/work/llvm-project/llvm/build/install/lib/cmake/llvm/LLVM-Config.cmake:230 (if):
    if given arguments:
      "engine" "IN_LIST" "link_components"
    Unknown arguments specified

Let set cmake policy for CMP0057 explicitly.

Signed-off-by: Yonghong Song <yhs@fb.com>
CMakeLists.txt