Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

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.

share|improve this question

1 Answer 1

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.