0
$\begingroup$

Rosanswers logo

I'm trying to use some boost functions in my C++ ROS code, but running into some frustrating issues with catkin.

In my CMakeLists.txt file, I have the following:

cmake_minimum_required(VERSION 2.8.3)

project(project_name)

find_package(
  catkin REQUIRED COMPONENTS
  roscpp
  rospy
  std_msgs
  Boost
)
include_directories(
  include ${catkin_INCLUDE_DIRS} ${roscpp_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS}
)

add_executable(exec_name src/exec_name.cpp)

target_link_libraries(exec_name ${catkin_LIBRARIES})

And I have installed libboost-all-dev on my Ubuntu 14.04 machine with apt-get. When I try to compile my project, however, I get the following error:

CMake Error at /opt/ros/indigo/share/catkin/cmake/catkinConfig.cmake:75 (find_package): Could not find a package configuration file provided by "Boost" with any of the following names:

BoostConfig.cmake
boost-config.cmake

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

I have searched all the files on the machine and cannot find anywhere a file named "BoostConfig.cmake" or "boost-config.cmake", are they something that should be included when I installed Boost through apt-get? If anyone could help me figure out why CMake can't find Boost, it would be hugely appreciated.


Originally posted by Jordan9 on ROS Answers with karma: 113 on 2015-04-09

Post score: 1

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

Can you try to search for Boost in a separate find_package() call?

According to CMake documentation, the syntax is

find_package(<package> [version] [EXACT] [QUIET] [MODULE]
         [REQUIRED] [[COMPONENTS] [components...]]
         [OPTIONAL_COMPONENTS components...]
         [NO_POLICY_SCOPE])

Since Boost is a separate package, and not a component of the catkin package, I believe you should search for it separately:

find_package(
  catkin
  REQUIRED COMPONENTS roscpp rospy std_msgs
)

find_package(
  Boost
  REQUIRED COMPONENTS algorithm
)

Originally posted by timm with karma: 376 on 2015-04-10

This answer was ACCEPTED on the original site

Post score: 2

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.