Boost logo

Boost Interest :

Subject: Re: [Boost-cmake] disabling particular external dependencies
From: troy d. straszheim (troy_at_[hidden])
Date: 2009-11-07 11:58:44

Sean Chittenden wrote:
> To have 1.41 do the right thing, be sure to set Boost_FIND_COMPONENTS
> and it will populate Boost_LIBRARIES (when include()'ing
> BoostConfig.cmake):
> set(Boost_FIND_COMPONENTS date_time program_options system thread
> unit_test_framework)
> include("${CONTRIBOBJ}/share/boost-${WANT_BOOST_VERSION}/cmake/BoostConfig.cmake")

Thanks for finding these workarounds. I've tuned up, tested and
documented a bunch of this stuff. Could you try out the head of my
1.41.0 branch, using the docs that are in the checkout? I'd like to
get this worked out before the next beta comes out, I'm aiming to
release a few hours after upstream does, like last time. the
COMPONENTS business in particular should now work like the previous
version, and you should get the debug or release version depending on

>> set(WANT_BOOST_LIBS date_time graph program_options regex signals
>> system thread unit_test_framework)
>> foreach(boost_lib ${WANT_BOOST_LIBS})
>> set(Boost_LIBRARIES ${Boost_LIBRARIES} "boost_${boost_lib}-mt-d")
>> endforeach(boost_lib ${WANT_BOOST_LIBS})
> When it comes time for unit tests, however, you get the lovely:
>> /opt/local/bin/g++-mp-4.3 -gdwarf-2 -Wno-deprecated -g
>> -Wl,-search_paths_first -headerpad_max_install_names -fPIC
>> CMakeFiles/foo_unittests.dir/
>> CMakeFiles/foo_unittests.dir/
>> CMakeFiles/foo_unittests.dir/
>> CMakeFiles/foo_unittests.dir/ -o
>> ../obj/contrib-Darwin-i386/bin/foo_unittests -L/opt/local/lib
>> -L/Users/sean/src/obj/contrib-Darwin-i386/lib/boost-1.41.0 -lpthread
>> -lboost_program_options-mt -lboost_system-mt -lboost_thread-mt
>> -lboost_unit_test_framework-mt
>> Undefined symbols:
>> "_main", referenced from:
>> start in crt1.10.5.o
>> ld: symbol(s) not found
>> collect2: ld returned 1 exit status
> The static library unit_test_framework has a main() function, however
> the .dylib/.so does not. I haven't played around with this much to find
> out why yet, but thought I'd throw that out there. The problem there
> came from a small change between versions:

I'll have to look in to this. I'm no expert on boost.test, but have you
checked the compile flags? IIRC you may need -DBOOST_TEST_DYN_LIB=1 or
somesuch if you intend to link to the .so. You might compare to the
bjam output by running bjam with -d2

> <1.41.0 set(Boost_USE_STATIC_LIBS ON)
> =1.41.0 set(Boost_USE_STATIC ON)
> Any chance Boost_USE_STATIC_LIBS could set Boost_USE_STATIC and throw a
> depreciation warning? :) -sc

I'll investigate.


Boost-cmake list run by bdawes at, david.abrahams at, gregod at, cpdaniel at, john at