问题
I am fairly new to using boost along with C++. I have just installed Boost 1.59.0 and I want to use the geometry library.
If I include FIND_PACKAGE( Boost 1.47 REQUIRED )
it finds boost and no problems arises. If I then include FIND_PACKAGE( Boost 1.47 COMPONENTS geometry REQUIRED )
I get the following error:
Unable to find the requested Boost libraries.
Boost version: 1.59.0
Boost include path: /usr/include
Could not find the following Boost libraries:
boost_geometry
No Boost libraries were found. You may need to set BOOST_LIBRARYDIR to the
directory containing Boost libraries or BOOST_ROOT to the location of
Boost.
If I run the following [ -f /usr/include/boost/geometry/geometry.hpp ] && echo "Found" || echo "Not found"
in the CLI I get Found
as a result. So it seems that it's there, but CMake tells me it's not.
What am I misunderstanding?
回答1:
COMPONENTS
is required only for built libraries. Geometry is an header-only library so it's not needed. You need only to find the boost headers location.
来源:https://stackoverflow.com/questions/33843400/cmake-boost-1-59-0-geometry