How to fix ROS error: missing cpp_commonConfig.cmake

Problem

When trying to build some ROS package using colcon build, you see an error message such as

CMake Error at /home/uli/dev/Versatile/catkin/install/catkin/share/catkin/cmake/catkinConfig.cmake:83 (find_package):
  Could not find a package configuration file provided by "cpp_common" with
  any of the following names:

    cpp_commonConfig.cmake
    cpp_common-config.cmake

  Add the installation prefix of "cpp_common" to CMAKE_PREFIX_PATH or set
  "cpp_common_DIR" to a directory containing one of the above files.  If
  "cpp_common" provides a separate development package or SDK, be sure it has
  been installed.
Call Stack (most recent call first):
  CMakeLists.txt:8 (find_package)

Solution

Catkin is currently not available in a form suitable for installing it from the official ROS2 sources.

Therefore, clone the repo, build it using colcon and then source install/setup.bash before building your package.

git clone https://github.com/ros/roscpp_core.git
cd roscpp_core/cpp_common
colcon build
source install/setup.bash

After that (in the same shell), build your other package using colcon build again.