You are not logged in.

#1 2018-07-07 09:28:12

Time0o
Member
Registered: 2016-10-18
Posts: 9

CMake cannot find boost algorithm

I have boost and boost-libs (1.67.0-4) installed via pacman but I'm having trouble including boost via CMake.
In a CMakeLists.txt file I have the following:

cmake_minimum_required(VERSION 3.6)                                              
                                                                                  
find_package(Boost 1.67 REQUIRED COMPONENTS algorithm graph) 

...

boost_graph is found but for boost_algorithm cmake complains:

CMake Error at /usr/share/cmake-3.11/Modules/FindBoost.cmake:2044 (message):
  Unable to find the requested Boost libraries.

  Boost version: 1.67.0

  Boost include path: /usr/include

  Could not find the following Boost libraries:

          boost_algorithm

  Some (but not all) of the required Boost libraries were found.  You may
  need to install these additional Boost libraries.  Alternatively, set
  BOOST_LIBRARYDIR to the directory containing Boost libraries or BOOST_ROOT
  to the location of Boost.

/usr/include/boost contains both an algorithm and a graph directory but /usr/lib/ only contains libboost_graph and not libboost_algorithm (not sure if this is intended).
This seems very strange to me, can anyone guess what the problem is? I have never needed to use boost_algorithm before and usually don't use CMake.

Offline

#2 2018-07-07 11:56:46

Raynman
Member
Registered: 2011-10-22
Posts: 1,539

Re: CMake cannot find boost algorithm

Both of these are header-only libraries, except for the parsers for GraphViz/GraphML; if you don't need those, boost-libs and the specification of COMPONENTS are not needed at all.

According to the docs/comments in the boost cmake module, it first tries to locate the boost include directories and set Boost_INCLUDE_DIRS. That should be all you need for the headers.

Offline

Board footer

Powered by FluxBB