Boost logo

Boost Users :

From: Matthew Burgess (matthew_at_[hidden])
Date: 2004-04-21 15:38:23


Hi folks,

http://www.boost.org/libs/test/doc/components/unit_test_framework/compilation.html
states that I can include <boost/test/included/unit_test_framework.hpp>
in order to avoid having to link against the unit_test_framework
library. However, the files it #includes are located in the boost test
library source directory which doesn't appear to be installed by the
default bjam procedure (I just get '/opt/boost/lib'
&'/opt/boost/include' directories after installing boost).

If it helps to clarify things here's some output:

---
bash-2.05b$ cat example1.cpp
#include <boost/test/included/unit_test_framework.hpp>
using boost::unit_test_framework::test_suite;
void test_function() {
  BOOST_CHECK(2 == 1); // intentional failure
}
test_suite* init_unit_test_suite(int, char* []) {
  test_suite* test = BOOST_TEST_SUITE("Unit test example 1");
  test->add(BOOST_TEST_CASE(&test_function));
  return test;
}
bash-2.05b$ g++ -I /opt/boost/include/boost-1_31/ -L /opt/boost/lib/ -o
test example1.cpp In file included from example1.cpp:2:
/opt/boost/include/boost-1_31/boost/test/included/unit_test_framework.h
pp:18:47: libs/test/src/execution_monitor.cpp: No such file or directory
...
---
The only place I find the required files is in the original location I
extracted the boost source tarball to.  I can (and have) copied the
'libs' directory to sit inside my 'include' directory and verified this
fixes things, but I doubt very much this is the correct solution.
I'm particularly concerned that if someone else wants to compile my toy
code, simply telling them to "install boost" might not be enough.
Related to all this is the issue of best-practice.  Should I make
efforts not to have to link to a library, what are the trade-offs?  Can
I simply take a copy of the required boost headers and place them
directly in my project's directory structure?  If not, is anyone aware
of an autoconf style macro that can be used to detect the presence of
the boost headers and/or libraries?  I took a quick glance at the
autoconf-archive but didn't see anything immediately.
Thanks for anyone who can hit me with a cluebat (or FAQ pointer).
Matt Burgess

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net