joto / osmium

C++/Javascript framework for working with OSM files.
http://wiki.openstreetmap.org/wiki/Osmium
GNU General Public License v3.0
123 stars 31 forks source link

define BOOST_TEST_DYN_LINK in CXXFLAGS rather than each test #66

Closed springmeyer closed 11 years ago

springmeyer commented 11 years ago

This is a change to the tests only. The logic is that a developer may need to avoid BOOST_TEST_DYN_LINK from being defined and this change makes that easy to tweak in one location.

In my case I found that on OS X with boost 1.53 (and likely all recent versions) BOOST_TEST_DYN_LINK and a static libboost_unit_test_framework.a do not play well together. Linking to a dynamic library works, but a static library results in:

Checking t/geometry/test_linestring_geometry.cpp...
g++ -I../include -I. -g -Wall -Wextra -Wredundant-decls -Wdisabled-optimization -pedantic -Wctor-dtor-privacy -Wnon-virtual-dtor -Woverloaded-virtual -Wsign-promo -o tests -I/opt/boost-53/include test_main.cpp test_utils.cpp t/geometry/test_linestring_geometry.cpp -L/opt/boost-53/lib/ -lboost_unit_test_framework
Undefined symbols for architecture x86_64:
  "boost::unit_test::unit_test_main(bool (*)(), int, char**)", referenced from:
      _main in cc8zROUk.o
ld: symbol(s) not found for architecture x86_64

However linking a static libboost_unit_test_framework.a works just fine as long as BOOST_TEST_DYN_LINK is not defined.