cmakeroscatkin

ROS Kinetic 'catkin_make' Fails because PROJECT_NAME is set to Project


I have been using ROS Kinetic for a while, and today when I went to make a new catkin workspace following the ROS tutorials page (http://wiki.ros.org/catkin/Tutorials/create_a_workspace) I get a CMake Error stating that PROJECT_NAME is set to Project, which is invalid. I have never run into this issue with any of my other work spaces I have created.

I do not want to mess with toplevel.cmake out of fear of screwing up my other work spaces.

Any ideas why this is happening?

CMake Error at /opt/ros/kinetic/share/catkin/cmake/catkin_package.cmake:91 (message):
  catkin_package() PROJECT_NAME is set to 'Project', which is not a valid
  project name.  You must call project() before calling catkin_package().

Thank you.


Solution

  • I was able to reproduce the above error you are getting. For that what I did is opened my CMakeLists.txt and commented the second line which defines the package Name, i.e., project(package_name). After that, I tried to build my package via catkin_make, but got below error(see the error inside yellow box):

    enter image description here

    Then, I tried to build the same package after uncommenting the above line. This time I was able to build my package(test, in my case) successfully, without any error.

    enter image description here

    CMakeLists.txt file contains project() as well as catkin_package() and the former function should be called before catkin_package() inside the file. So, project(package_name) is either missing from your CMakeLists.txt file or is commented.

    If it is missing, then manually add it. If it is there, but commented then uncomment it.

    Read more about the correct format of CMakeLists.txt file from here.