[CMake] Can't get Boost_${COMPONENT}_LIBRARY to work

Philip Lowman philip at yhbt.com
Mon Mar 2 21:11:57 EST 2009


On Mon, Mar 2, 2009 at 7:20 PM, E. Wing <ewmailing at gmail.com> wrote:

> I want to link something against the date_time library in boost. The
> comments in the FindBoost.cmake module imply that I
> should be able to use something like ${Boost_date_time_LIBRARY}. But the
> variable is always empty for me.
>
> Here is my code:
> SET(Boost_USE_STATIC_LIBS   ON)
> SET(Boost_USE_MULTITHREADED ON)
> FIND_PACKAGE(Boost 1.3.6 COMPONENTS date_time filesystem regex system)

 The "1.3.6" is a typo, btw.  You probably want "1.36" or whatever minimum
version you need to use boost

>
> MESSAGE("boost libs ${Boost_LIBRARIES}")
> MESSAGE("boost date_time: ${Boost_date_time_LIBRARY}, found:
> ${Boost_date_time_FOUND}")
> MESSAGE("boost filesys: ${Boost_filesystem_LIBRARY}, found:
> ${Boost_filesystem_FOUND}")
>
> And my output:
> boost libs
> /usr/local/lib/libboost_date_time-mt.dylib;/usr/local/lib/libboost_filesystem-mt.dylib;/usr/local/lib/libboost_regex-mt.dylib;/usr/local/lib/libboost_system-mt.dylib
> boost date_time: , found:
> boost filesys: , found:
>
> Am I misunderstanding something?


Looks like a documentation bug.  From what I can tell all Boost components
use uppercase in their names (the libraries also show up in the advanced
part of the cache).  I've fixed the documentation of FindBoost.cmake in CVS.

Also, one additional thing.  If you use Boost_LIBRARIES it will
automatically contain all of the libraries you specify after the COMPONENTS
line (including debug/optimized keywords).  This is often fine for many
Boost use-cases.  If it's not and you must link individually, the way you
were doing it should work fine, just make the components be UPPERCASE.



-- 
Philip Lowman
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20090302/228415d3/attachment.htm>


More information about the CMake mailing list