[CMake] fun with Boost - swap absolute library path for -L and -l?

Adam J Richardson fatman at crackmonkey.us
Thu Nov 11 08:51:47 EST 2010


> On Thu, 11 Nov 2010 07:07:48 -0500
> cmake-request at cmake.org wrote:
> 
> > Any help is greatly appreciated!
> 
> I'd help if I could. Unfortunately I'm still stuck on this. Usually I
> can work around a problem given enough time, but this is a real
> stumper. Actually I do have a suggestion (see below) but it's kind of
> ugly.

This always happens. Declare complete stumpitude and almost immediately
find a solution. This is the problem: I'm linking statically and
boost_thread wants to link dynamically.

The clue is in the first error in the build log: "undefined reference
to `_imp___blablabla'". The "_imp___" part gives it away. The fix is to
define BOOST_THREAD_USE_LIB in your CMakeLists.txt:

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DBOOST_THREAD_USE_LIB=1")

I haven't tested it, but it builds without complaint now.

HtH,
Adam J Richardson
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://www.cmake.org/pipermail/cmake/attachments/20101111/3780e90f/attachment.pgp>


More information about the CMake mailing list