[CMake] FindBoost problem

Michael Hertling mhertling at online.de
Wed May 26 15:50:46 EDT 2010


On 05/26/2010 07:52 PM, Nico Schlömer wrote:
> Hi all,
> 
> I'd like to use CMake for an application that I'm developing on an
> Ubuntu machine which needs to link against Boost, i.e., a
> custom-compiled installation at /opt/boost/1.43.0/.
> 
> I compiled and installed CMake 2.8.1, FindBoost.cmake comes in handy.
> Ubuntu ships with its own Boost development package (1.40.0) which I
> cannot remove because it's used by other packages. By default, CMake
> finds the stock-Boost (I guess b/c it sits in those default folders),
> so I call cmake with
> 
>   cmake -DBOOST_ROOT:PATH=/opt/boost/1.43.0/ /path/to/source/
> 
> Boost is found, and the variables are set in CMakeCache.txt, e.g.,
> 
>     Boost_INCLUDE_DIR:PATH=/opt/boost/1.43.0/include
> 
> I however also notice that the actual libraries are *not* set correctly, as
> 
>     Boost_FILESYSTEM_LIBRARY:FILEPATH=/usr/lib/libboost_filesystem-mt.so
> 
> This makes the build fail. Setting BOOST_LIBRARYDIR does not help.

The same problem showed up here, and I have tracked it down to the fact
that FindBoost.cmake, as default, searches for Boost libraries with the
multithread mark in name, e.g. "/usr/lib/libboost_date_time-mt.so" from
the distribution, while my custom-compiled 1.43.0 libraries do not have
the "mt" infix anymore, e.g. "/usr/local/lib/libboost_date_time.so". A
solution has been to unset Boost_USE_MULTITHREADED before invoking the
FIND_PACKAGE(Boost ...), e.g. "cmake -DBoost_USE_MULTITHREADED=0 ..".

'hope that helps.

Regards,

Michael


More information about the CMake mailing list