CMakeError: package configuration by moveit_common
I have a package that uses moveit2 and when I try to build it with colcon build I get the following error:
CMake Error at CMakeLists.txt:28 (find_package):
By not providing "Findmoveit_common.cmake" in CMAKE_MODULE_PATH this
project has asked CMake to find a package configuration file provided by
"moveit_common", but CMake did not find one.
Could not find a package configuration file provided by "moveit_common"
with any of the following names:
moveit_commonConfig.cmake
moveit_common-config.cmake
Add the installation prefix of "moveit_common" to CMAKE_PREFIX_PATH or set
"moveit_common_DIR" to a directory containing one of the above files. If
"moveit_common" provides a separate development package or SDK, be sure it
has been installed.
I tried to uninstall and install moveit with the command: sudo apt install ros-foxy-moveit
. I sourced the ros environment from the directory I'm calling colcon build: source /opt/ros/foxy/setup.bash
. I added <build_depend>moveit_common</build_depend>
in my package.xml and find_package(moveit_common REQUIRED)
in my CMakeLists.txt. None of those worked I didn't find anything relevant online so far. I don't understand how I can add the installation prefix of moveit_common in my CMAKE_PREFIX_PATH. What is the problem here?
I'm using Ubuntu 20.04, ROS2 Foxy