Hi folks,
http://www.boost.org/libs/test/doc/components/unit_test_framework/compilatio...
states that I can include
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
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