2

I installed boost like proposed in this Installing Boost under Ubuntu question. However, when I try to execute a cmake file which tries to include boost like:

find_package(Boost CONFIG REQUIRED COMPONENTS system)

It tells me that it can't find neither of the following two files:

BoostConfig.cmake boost-config.cmake

There is the hint that one should add the installation prefix of "Boost" to CMAKE_PREFIX_PATH or set "Boost_DIR" to a directory containg on of the above files.

However, how can I do this? And how do I know where to find these files or the directory after installing it via apt-get?

I am using cmake version 3.5.1, for boost I found out the version via

dpkg -s libboost-all-dev

which is 1.58.0.1ubuntu1

Kev1n91
  • 3,553
  • 8
  • 46
  • 96
  • Which version of boost and which version of CMake? – Dan Mašek Aug 21 '17 at 18:34
  • cmake 3.5.1, boost I could not tell due to installing it via apt-get – Kev1n91 Aug 21 '17 at 18:56
  • Sure you can, those packages also have version numbers. If the boost is newer than 1.61, [this version of cmake](https://github.com/Kitware/CMake/blob/v3.5.1/Modules/FindBoost.cmake#L830) won't find it. Or just look inside `boost/version.hpp`. – Dan Mašek Aug 21 '17 at 19:34
  • boost is 1.58.0.1ubuntu1 , i edited the question – Kev1n91 Aug 21 '17 at 20:36
  • Interesting. Those two should work together. Unfortunately it's been a while since I've developed on a linux box... hopefully someone else can point out the issue. – Dan Mašek Aug 21 '17 at 22:04
  • I guess in the worst case forget about finding it and just add include directory for [`/usr/include`](https://packages.ubuntu.com/xenial/amd64/libboost1.58-dev/filelist) and [`/usr/lib/x86_64-linux-gnu`](https://packages.ubuntu.com/xenial/amd64/libboost-system1.58-dev/filelist) (assuming you're on 64bit) -- that's where the files ought to be installed. – Dan Mašek Aug 21 '17 at 22:07

1 Answers1

1

rm the CONFIG from your find_package cmd.

i.e: find_package(Boost REQUIRED COMPONENTS system)

The CONFIG is head-only, see this link: CMake cannot find Boost libarary

Wei Guo
  • 544
  • 3
  • 15