[CMake] Boost_DIR

David Cole david.cole at kitware.com
Wed Sep 5 14:39:05 EDT 2012


On Wed, Sep 5, 2012 at 2:24 PM, David Doria <daviddoria at gmail.com> wrote:
> On Wed, Sep 5, 2012 at 2:16 PM, Klaim - Joël Lamotte <mjklaim at gmail.com> wrote:
>> I might be wrong but my understanding is that it's the other way arround:
>> you provide Boost_DIR (root of your boost installation) and it finds the
>> rest itself.
>> I've been using it like that. I have a custom build of boost in a specific
>> directory and an environnement variable Boost_DIR set  to it. I also set
>> Boost_ROOT to be sure because previous versions of CMake
>> would look for it.
>>
>> Joel Lamotte
>>
>
> Joel,
>
> I tried that -
>
> with
>
> export Boost_DIR=/home/doriad/build/Boost_1_51/
>
> in my ~/.profile
>
> and using:
>
> FIND_PACKAGE(Boost 1.51)
>
> ccmake still shows:
>
>  Boost_DIR       =                *Boost_DIR-NOTFOUND
>
> But as I mentioned,  Boost_INCLUDE_DIR and Boost_LIBRARY_DIRS are set
> correctly, and everything builds fine. It is just terribly confusing
> for one of the first things a user sees in ccmake is
> Boost_DIR-NOTFOUND, even though everything is configured properly!
>
> David
> --
>
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake


That variable is never set by FindBoost. It must be find_package
internally setting that since it never found a BoostConfig.cmake file.
I agree that it's confusing, but there are several different ways to
build/install boost out in the wild, and FindBoost tries to
accommodate all of them, even the installations without any
BoostConfig file. (In my view, it's unfortunate that there are quite
so many different ways of installing boost.)

It's just one of the things I think you get used to with building a
CMake project that uses boost...

Maybe the FindBoost maintainers will chime in here, too. Perhaps
there's a way to mark the variable INTERNAL when it finds a boost that
has no config file.

If not, though, myabe you could just do a "mark_as_advanced()" on it
so it gets hidden from the view of the users of your project.


Cheers,
David C.


More information about the CMake mailing list