Boost logo

Boost Interest :

Subject: Re: [Boost-cmake] disabling particular external dependencies
From: Sean Chittenden (sean_at_[hidden])
Date: 2009-11-06 16:28:01

>> I can populate the list of libs that I need by hand, but am looking
>> for guidance on what's the right way forward.
>> Is there a correct way to use find_package(Boost...) with an
>> installed 1.41.0 atm? I notice Boost_VERSION is set as a string in
>> BoostConfig.cmake but the older FindBoost.cmake that comes with
>> cmake 2.6.4 is expecting an integer. -sc
> Sorry about this... you've turned up some bugs that I'm working on,
> I've built an entire test harness for this stuff, I expect the
> regression list to start dropping quickly. But for now stay tuned.

To have 1.41 do the right thing, be sure to set Boost_FIND_COMPONENTS
and it will populate Boost_LIBRARIES (when include()'ing

set(Boost_FIND_COMPONENTS date_time program_options system thread

> 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:

<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

Sean Chittenden

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