1

In my code, I want to make use of boost::hash<pair<int, int>>, for which I need to:

#include <boost/functional/hash.hpp>

I use the cmake to build my project. What package should I request with find_package in CMakeLists.txt? Right now I have: find_package(Boost COMPONENTS program_options regex REQUIRED). I don't have any errors, but I suspect the reason for that is that I have all the boost libraries installed.

Paul Baltescu
  • 2,095
  • 4
  • 25
  • 30

1 Answers1

2

Functional is a header only library, so you don't need add anything, because header only libraries will not be linked. See Which boost libraries are header-only? also or http://www.boost.org/doc/libs/1_53_0/more/getting_started/unix-variants.html#header-only-libraries.

Community
  • 1
  • 1
mistapink
  • 1,926
  • 1
  • 26
  • 37
  • So I only need to use `find_package` with libraries that need to be built? What if this header was the only thing I used from Boost? Shouldn't I configure `cmake` to look for the requirements of the project? (I'm a bit confused by what `cmake` can actually, because I've recently switched to it from `autotools`). – Paul Baltescu May 09 '13 at 20:41
  • This is more a question what boost can do than cmake, but you only need find_package in conjunction with build libs. Header only libraries will not be linked, thus they don't need to be added: http://www.boost.org/doc/libs/1_53_0/more/getting_started/unix-variants.html#header-only-libraries – mistapink May 09 '13 at 20:48