0
votes

I wanted to give CLion a try for working with the ROS source code. I created a ROS Workspace and have the following folder structure:

joesan@joesan-InfinityBook-S-14-v5:~/Projects/Private/ros-projects$ cd catkin_ws/
drwxrwxr-x joesan joesan  4 KB Sun Aug 30 10:48:27 2020  .
drwxrwxr-x joesan joesan  4 KB Sun Aug 30 10:48:10 2020  ..
.rw-rw-r-- joesan joesan 98 B  Sun Aug 30 10:48:27 2020  .catkin_workspace
drwxrwxr-x joesan joesan  4 KB Sun Aug 30 10:48:27 2020  build
drwxrwxr-x joesan joesan  4 KB Sun Aug 30 10:48:26 2020  devel
drwxrwxr-x joesan joesan  4 KB Sun Aug 30 12:13:50 2020  src
joesan@joesan-InfinityBook-S-14-v5:~/Projects/Private/ros-projects/catkin_ws$ 

I have sourced this location in the .bash_profile as below:

# Dynamically source all setup.bash files from multiple catkin ros workspaces
find /home/joesan/Projects/Private/ros-projects -wholename '*/devel/setup.bash' | xargs source

I then source the .bash_profile from within my .bashrc

Now, when I tried to open the project in CLion, I see the following error:

CMake Error at CMakeLists.txt:65 (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.

I launch CLion via a Desktop shortcut entry that I created. How do I make CLion aware of this .bash_profile such that it can find catkin?

1

1 Answers

0
votes

I managed to fix this by doing the following, but make sure that you have a Desktop entry created for Jetbrains CLion beforehand!

Open the jetbrains-clion.desktop located in the .local folder:

~/.local/share/applications/jetbrains-clion.desktop

In this desktop entry, modify the Exec= line as:

Exec=bash -i -c "/opt/softwares/clion-2020.2.1/bin/clion.sh" %f