Reputation: 312
I am using CMake to generate my make file.
However, in one of my files, I need to use boost::network::uri::valid(uri_)
. So I have included the header file (#include boost/network/uri.hpp
) and I am using the boost::network::uri::valid(uri_)
function.
How can I tell CMake to use this header uri.hpp
and to add the required library?
I have read that I can use find_package
but I have no or little knowledge about that.
I am using cpp-netlib-0.9.4.
Upvotes: 1
Views: 248
Reputation: 2251
You want to use
find_package(Boost 1.55)
to locate the headers and libraries for Boost. If you have Boost installed in some custom location on your machine, then set BOOST_INCLUDE_DIR
like this:
set(BOOST_INCLUDEDIR D:/Code/boost/boost_1_55_0)
The command cmake --help-package FindBoost
will show you help on the various variables set by find_package(Boost)
so that you can use the appropriate library variable (if necessary, many Boost libraries are header-only) for your target. You can see some examples of how to use CMake in conjunction with a downloaded Boost distribution and Boost.Test in my talk on doing test-driven development with Boost.Test.
Upvotes: 0