Find package rclcpp throwing Cmake Error

Hello,

My project in ros2 has

find_package(rclcpp REQUIRED)

which is throwing all this build error:

CMake Warning (dev) at /opt/ros/ardent/share/ament_cmake_core/cmake/core/list_append_unique.cmake:30 (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):
  /opt/ros/ardent/share/rclcpp/cmake/ament_cmake_export_dependencies-extras.cmake:36 (list_append_unique)
  /opt/ros/ardent/share/rclcpp/cmake/rclcppConfig.cmake:30 (include)
  CMakeLists.txt:24 (find_package)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Error at /opt/ros/ardent/share/ament_cmake_core/cmake/core/list_append_unique.cmake:30 (if):
  if given arguments:

    "NOT" "element" "IN_LIST" "rclcpp_RECURSIVE_DEPENDENCIES"

  Unknown arguments specified
Call Stack (most recent call first):
  /opt/ros/ardent/share/rclcpp/cmake/ament_cmake_export_dependencies-extras.cmake:36 (list_append_unique)
  /opt/ros/ardent/share/rclcpp/cmake/rclcppConfig.cmake:30 (include)
  CMakeLists.txt:24 (find_package)

What could be wrong?

It was an error with the cmake policy.
Needed to update the minimum required version for cmake to atleast 3.3.
Previously had 2.8.3

2 Likes