Trouble opening package in qtcreator

Hi,
I realized today that I can’t open any CMakeLists.txt from any ros2 packages in qtcreator anymore. This worked for me until two weeks ago.

For example if I try opening this package: https://github.com/firesurfer/ros2_simple_logger/
I do the following:

  1. Open a shell
  2. Source the ros2 workspace
  3. Build the workspace the package is in
  4. Source this workspace
  5. In this terminal I open qtcreator
  6. Then I configure the build folder into a seperate folder (for example qt_build/ros2_simple_logger)
  7. I run into this error:

– Found fastrtps_cmake_module: 0.0.2 (/home/firesurfer/workspace/ros2_ws/install/share/fastrtps_cmake_module/cmake)
CMake Error at /usr/share/cmake-3.7/Modules/FindPackageHandleStandardArgs.cmake:138 (message):
Could NOT find FastRTPS (missing: FastRTPS_INCLUDE_DIR FastRTPS_LIBRARIES)

Any tipps what I can do in order to resolve this issue?

This looks similar to the issue reported here,
Can you try running export CMAKE_PREFIX_PATH=$AMENT_PREFIX_PATH:$CMAKE_PREFIX_PATH between step 4 and 5 and report here with the outcome ?

Thanks!

That’s it. Works fine now.

Wouldn’t it be possible to integrate this step into the setup script of the workspace? I think its quite annoying to do this by hand.

The current setup files only set/update environment variables in order to “run” the ROS 2 packages.

There might be separate scripts in the future to setup the environment for building (see https://github.com/ament/ament_tools/issues/76). For now you have to set the CMAKE_PREFIX_PATH manually.