# Revision history [back]

### error in find_package(), when building with custom message.

Hello,

I have built ros2 from the latest stable source in Ubuntu 16.04. I was experimenting with colcon to build my own package as mentioned here and custom messages from this tutorial define custom interfaces. My directory has the following structure:

--ros2_ws
|--src
|--pendulum_test
|--pendulum_controltwo
|--CMakeLists-.txt
|--package.xml
|--src
|--pendulumtwo_msgs
|--CMakeLists-.txt
|--package.xml
|--src


my project is the same as pendulum_control and pendulum_msgs demo with appropriate name modifications in CMakeLists.txt and package.xml.

My build procedure is as follows:

1. In the pendulumtwo_msgs directory, I used

colcon build

It was successful

2. I sourced the pendulumtwo_msgs/install/local_setup.bash

3. In the pendulum_controltwo directory I used "colcon build" again

This gave me the following error:

-------------------------error starts here--------------------------

Starting >>> pendulumtwo_control --- stderr: pendulumtwo_control
CMake Error at CMakeLists.txt:22 (find_package): By not providing "Findpendulumtwo_msgs.cmake" in CMAKE_MODULE_PATH this project has asked CMake to find a package configuration file provided by "pendulumtwo_msgs", but CMake did not find one.

Could not find a package configuration file provided by "pendulumtwo_msgs" with any of the following names:

pendulumtwo_msgsConfig.cmake
pendulumtwo_msgs-config.cmake


Add the installation prefix of "pendulumtwo_msgs" to CMAKE_PREFIX_PATH or set "pendulumtwo_msgs_DIR" to a directory containing one of the above files. If "pendulumtwo_msgs" provides a separate development package or SDK, be sure it has been installed.

Failed <<< pendulumtwo_control [ Exited with code 1 ]

Summary: 0 packages finished [2.34s] 1 package failed: pendulumtwo_control 1 package had stderr output: pendulumtwo_control

---------------------error ends here-------------------------------------

The problem looked very similar to this thread. I looked in the build log and noticed that CMAKE_PREFIX_PATH was set to: /ros2_ws2/src/pendulum_test/pendulumtwo_msgs/install/pendulum_msgs and the cmake files mentioned in the error are present in the recently mentioned install directory. I'm not sure if CMAKE_FIND_ROOT_PATH is being overrided some how as mentioned in the referenced thread.

I hope my build procedure is correct and any advice on solving this error would be appreciated.

 2 None jayess 5089 ●17 ●56 ●72

### error in find_package(), when building with custom message.

Hello,

I have built ros2 from the latest stable source in Ubuntu 16.04. I was experimenting with colcon to build my own package as mentioned here and custom messages from this tutorial define custom interfaces. My directory has the following structure:

--ros2_ws
|--src
|--pendulum_test
|--pendulum_controltwo
|--CMakeLists-.txt
|--package.xml
|--src
|--pendulumtwo_msgs
|--CMakeLists-.txt
|--package.xml
|--src


my project is the same as pendulum_control and pendulum_msgs demo with appropriate name modifications in CMakeLists.txt and package.xml.

My build procedure is as follows:

1. In the pendulumtwo_msgs directory, I used

colcon build

It was successful

2. I sourced the pendulumtwo_msgs/install/local_setup.bash

3. In the pendulum_controltwo directory I used "colcon build" again

This gave me the following error:

-------------------------error starts here--------------------------

Starting >>> pendulumtwo_control
--- stderr: pendulumtwo_control
CMake Error at CMakeLists.txt:22 (find_package):
By not providing "Findpendulumtwo_msgs.cmake" in CMAKE_MODULE_PATH this
project has asked CMake to find a package configuration file provided by
"pendulumtwo_msgs", but CMake did not find one. one.

Could not find a package configuration file provided by "pendulumtwo_msgs"
with any of the following names: names:

pendulumtwo_msgsConfig.cmake
pendulumtwo_msgs-config.cmake
Add the installation prefix of "pendulumtwo_msgs" to CMAKE_PREFIX_PATH or
set "pendulumtwo_msgs_DIR" to a directory containing one of the above
files.  If "pendulumtwo_msgs" provides a separate development package or
SDK, be sure it has been installed.  installed.

---
Failed   <<< pendulumtwo_control    [ Exited with code 1 ] ]

Summary: 0 packages finished [2.34s]
1 package failed: pendulumtwo_control
1 package had stderr output: pendulumtwo_controlpendulumtwo_control


---------------------error ends here-------------------------------------

The problem looked very similar to this thread. I looked in the build log and noticed that CMAKE_PREFIX_PATH was set to: /ros2_ws2/src/pendulum_test/pendulumtwo_msgs/install/pendulum_msgs and the cmake files mentioned in the error are present in the recently mentioned install directory. I'm not sure if CMAKE_FIND_ROOT_PATH is being overrided some how as mentioned in the referenced thread.

I hope my build procedure is correct and any advice on solving this error would be appreciated.

### error in find_package(), when building with custom message.

Hello,

I have built ros2 from the latest stable source in Ubuntu 16.04. I was experimenting with colcon to build my own package as mentioned here and custom messages from this tutorial define custom interfaces. My directory has the following structure:

--ros2_ws
|--src
|--pendulum_test
|--pendulum_controltwo
|--CMakeLists-.txt
|--package.xml
|--src
|--pendulum_demo.cpp
|--pendulumtwo_msgs
|--CMakeLists-.txt
|--package.xml
|--src
|--msg


my project is the same as pendulum_control and pendulum_msgs demo with appropriate name modifications in CMakeLists.txt and package.xml.

My build procedure is as follows:

1. In the pendulumtwo_msgs directory, I used

colcon build

It was successful

2. I sourced the pendulumtwo_msgs/install/local_setup.bash

3. In the pendulum_controltwo directory I used "colcon build" again

This gave me the following error:

-------------------------error starts here--------------------------

Starting >>> pendulumtwo_control
--- stderr: pendulumtwo_control
CMake Error at CMakeLists.txt:22 (find_package):
By not providing "Findpendulumtwo_msgs.cmake" in CMAKE_MODULE_PATH this
project has asked CMake to find a package configuration file provided by
"pendulumtwo_msgs", but CMake did not find one.

Could not find a package configuration file provided by "pendulumtwo_msgs"
with any of the following names:

pendulumtwo_msgsConfig.cmake
pendulumtwo_msgs-config.cmake

Add the installation prefix of "pendulumtwo_msgs" to CMAKE_PREFIX_PATH or
set "pendulumtwo_msgs_DIR" to a directory containing one of the above
files.  If "pendulumtwo_msgs" provides a separate development package or
SDK, be sure it has been installed.

---
Failed   <<< pendulumtwo_control    [ Exited with code 1 ]

Summary: 0 packages finished [2.34s]
1 package failed: pendulumtwo_control
1 package had stderr output: pendulumtwo_control


---------------------error ends here-------------------------------------

The problem looked very similar to this thread. I looked in the build log and noticed that CMAKE_PREFIX_PATH was set to: /ros2_ws2/src/pendulum_test/pendulumtwo_msgs/install/pendulum_msgs and the cmake files mentioned in the error are present in the recently mentioned install directory. I'm not sure if CMAKE_FIND_ROOT_PATH is being overrided some how as mentioned in the referenced thread.

I hope my build procedure is correct and any advice on solving this error would be appreciated.

package.xml:

<?xml version="1.0"?>
<package format="2">
<name>pendulum_controltwo</name>
<version>0.5.1</version>
<description>Demonstrates ROS 2's realtime capabilities with a simulated inverted pendulum.</description>

<maintainer email="mikael@osrfoundation.org">Mikael Arguedas</maintainer>

<author>Jackie Kay</author>

<buildtool_depend>ament_cmake</buildtool_depend>

<build_depend>rclcpp</build_depend>
<build_depend>pendulumtwo_msgs</build_depend>
<build_depend>rttest</build_depend>

<exec_depend>rclcpp</exec_depend>
<exec_depend>pendulumtwo_msgs</exec_depend>
<exec_depend>rttest</exec_depend>

<export>
<build_type>ament_cmake</build_type>
</export>
</package>


CMakeLists.txt:

cmake_minimum_required(VERSION 3.5)

project(pendulum_controltwo)

if(APPLE OR WIN32)
message(STATUS "The pendulum_control demo is only supported on Linux. Package will not be built.")
return()
endif()

find_package(ament_cmake REQUIRED)

# Default to C++14
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 14)
endif()

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
endif()

find_package(rclcpp REQUIRED)
find_package(pendulumtwo_msgs REQUIRED)
find_package(rttest)

include_directories(include)

if(NOT rttest_FOUND)
add_executable(pendulum_demo${target_suffix} src/pendulum_demo.cpp) ament_target_dependencies(pendulum_demo${target_suffix}
"rclcpp${target_suffix}" "rttest") install(TARGETS pendulum_demo${target_suffix}