[CMake] Problem with FindBoost.cmake

Philip Lowman philip at yhbt.com
Tue May 19 08:15:03 EDT 2009


On Sun, May 17, 2009 at 2:35 PM, Robert Dailey <rcdailey at gmail.com> wrote:

> On Sun, May 17, 2009 at 12:16 PM, Philip Lowman <philip at yhbt.com> wrote:
>
>> On Sun, May 17, 2009 at 12:26 AM, Robert Dailey <rcdailey at gmail.com>wrote:
>>
>>> Hi,
>>> I have built Boost 1.39 on Windows with static libraries, and they are
>>> named like so:
>>>
>>> libboost_filesystem-mt.lib
>>>
>>> When I try to do this:
>>>
>>> find_package( Boost REQUIRED COMPONENTS filesystem )
>>>
>>> I get an error saying it could not find boost_filesystem. If I rename the
>>> above library and remove the 'lib' prefix, so it is just
>>> "boost_filesystem-mt.lib", it finds it. Does the FindBoost.cmake module not
>>> support the lib prefix on Windows? This might be an inconsistency on Boost's
>>> part.
>>>
>>
>> Have you set(Boost_USE_STATIC_LIBS ON)?
>>
>> This might be related to a post a while back which never was fully
>> resolved involving FindBoost and static libs / dynamic stdlib vs. static
>> libs / static stdlib.
>>
>> Also, which version of FindBoost are you using?
>>
>
> I'm using the one packaged with CMake 2.6.4. Normally, the FindXXX modules
> will provide any configurable options as variables in the cache. However, in
> this case, it seems like the FindBoost module checks
> for Boost_USE_STATIC_LIBS, but does not make it immediately visible in the
> cache (i.e. the user has to set it themselves).
>

I think it's probably best to leave it up to individual projects if they
would like to expose Boost_USE_STATIC_LIBS to their cache.  You can of
course do so simply by writing

option(Boost_USE_STATIC_LIBS "Use boost static libraries" ON)
   prior to
find_package(Boost...)

Until recently (i.e. the unset(...CACHE) command) it was not possible for
user code to remove variables from the cache.  Generally I think this has
yielded a conservative policy of module writers not adding options to the
cache.

-- 
Philip Lowman
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20090519/46309eaf/attachment.htm>


More information about the CMake mailing list