CMake produces error after editing CMakelists.txt in ROS beginner tutorial 10
I have been working through the ROS tutorials and about midway through ROS tutorial 10 where I changed the CMakelists.txt file to the new msg and srv output and went to build catkin again, it now produces the following error:
CMake Error at CMakeLists.txt:56 (find_package):
find_package called with invalid argument "roscpp"
CMake Error at CMakeLists.txt:66 (message):
find_package(catkin) failed. catkin was neither found in the workspace nor
in the CMAKE_PREFIX_PATH. One reason may be that no ROS setup.sh was
sourced before.
-- Configuring incomplete, errors occurred!
See also "/home/benjamin/catkin_ws/build/CMakeFiles/CMakeOutput.log".
Invoking "cmake" failed
I believe the second error only arose later because in trying to solve the problem I deleted my entire catkin directory and tried to start again from scratch. However, it continues to try and build from the old CMakelists.txt file. Despite trying to start from scratch many times it continues to be unable to run Cmake.
I have tried to run cmake clean, but after deleting my catkin directory it produces an error that it cannot recognise catkin in my buildpath any longer.
ROS env:
ROS_ETC_DIR=/opt/ros/melodic/etc/ros
ROS_ROOT=/opt/ros/melodic/share/ros
ROS_MASTER_URI=http://localhost:11311
ROS_VERSION=1
ROS_PYTHON_VERSION=2
ROS_IP=192.168.100.169
ROS_PACKAGE_PATH=/opt/ros/melodic/share
ROSLISP_PACKAGE_DIRECTORIES=
ROS_DISTRO=melodic
This is the offending section of CMakelists.txt:
# search for catkin in all workspaces
set(CATKIN_TOPLEVEL_FIND_PACKAGE TRUE)
find_package(catkin QUIET
roscpp
rospy
std_msgs
message _generation
NO_POLICY_SCOPE
PATHS ${catkin_search_path}
NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
unset(CATKIN_TOPLEVEL_FIND_PACKAGE)
Could you please show your complete
CMakeLists.txt
? The section you show is not something I would have expected to appear in a standard, regular, package-level build script for a ROS package.Please: always link to whatever you are reading/following. We cannot guess what "the ROS tutorials" means (yes, we could assume it means the ones on the main ROS wiki, but when diagnosing problems, assuming things is bad).