ROS catkin_make with CLion troubles

Answered

Hi,

I'm experiencing some problems in using CLion with ROS packages (until now I correctly used Qtcreator, but I want to migrate to CLion).

First of all I wanted CLion not to automatically run cmake (creating the cmake-folder) when I load a project from a CMakeList.txt, since I need to compile in a different directory: actually, once I've deleted such a cmake-folder, automatically created by CLion, I am able to indicate a different build directory, but delete every time the useless (for me) cmake-folder is annoying.

Even more important, CLion builds everything in the selected directory, while catkin_make of ROS generate a devel folder (not inside build!). How can I say to Clion to behave as catkin_make command of ROS?

thanks a lot,

regards,

Bart

0
4 comments

Starting from version 2016.3, you can just open CMakeCache.txt in a directory that already contained generated CMake files.

0
Avatar
Permanently deleted user

First part is right, so thanks for the answer. I just open the CMakeCache.txt inside my build directory, and the compilation is correctly done there.

However, it is still putting all the executable in a generated devel folder, whilst in catkin the generated executables are put in a devel folder that is at the same file system level of the build directory, i.e.

I can manually modify the CMakeLists.txt to choose a relative path for the executable, but qtcreator does it automatically. Is there a way to obtain the same behaviour in CLion?

 [edit]

This is contained in the CMakeCache.txt created by catkin_make

//catkin devel space
CATKIN_DEVEL_PREFIX:PATH=/home/bart/srrg_ws/devel

this row simply disappear when I load the CMakeCache.txt in CLion, and immediately a devel folder is created at the same level of CMakeCache.txt

 

thanks,

Bart

1
Avatar
Permanently deleted user

Was pointed towards this post after having the same issues:

  1. Getting CLion to use $WORKSPACE/build as the build directory
  2. Getting CLion to place built targets in $WORKSPACE/devel

1 in Settings->Build, Execution, Deployment->CMake set the Generation Path to your $WORKSPACE/build directory.

2 Add "-DCATKIN_DEVEL_PREFIX:PATH=$WORKSPACE/devel" to the "CMake Options" setting on the same page.

Note:  $WORKSPACE here is just a place holder for wherever your workspace actually is.  For Bart he'd use "-DCATKIN_DEVEL_PREFIX:PATH=/home/bart/srrg_ws/devel"

Running build on targets in CLion now seems to behave like catkin, at least for me.

0
Avatar
Permanently deleted user

I have set CATKIN_DEVEL_PREFIX as described by Zac and here, but CLion still uses a wrong one (inside the build folder).

My "Build options" line: -DCATKIN_DEVEL_PREFIX:PATH=/home/myname/catkin_ws/devel/

CMake output immediately after pressing OK:

/usr/local/clion-2018.3.2/bin/cmake/linux/bin/cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -G "CodeBlocks - Unix Makefiles" /home/myname/catkin_ws/src
-- Using CATKIN_DEVEL_PREFIX: /home/myname/catkin_ws/build/devel

Why does this behavior occur?

 

Edit: User error. I put the custom CMake options into the Build options line, which is not correct of course...

0

Please sign in to leave a comment.