[CMake] Boost on Windows

Michael Jackson mike.jackson at bluequartz.net
Tue Jun 23 16:51:05 EDT 2009


On Jun 23, 2009, at 4:23 PM, Bill Hoffman wrote:

> Christopher Harvey wrote:
>> define BOOST_ROOT and point it at the root install location for  
>> boost. I
>> had the same problem, that fixed it. I only had to do that on  
>> windows.
> There seems to be a bug in the FindBoost, BOOST_ROOT should not be  
> required.   I got it to work by adding this:
>
>
>  SET(_boost_LIBRARIES_SEARCH_DIRS
>    C:/boost/lib
>    C:/boost
> "$ENV{ProgramFiles}/boost/boost_${Boost_MAJOR_VERSION}_$ 
> {Boost_MINOR_VERSION}_${Boost_SUBMINOR_VERSION}/lib"
> "$ENV{ProgramFiles}/boost/boost_${Boost_MAJOR_VERSION}_$ 
> {Boost_MINOR_VERSION}/lib"
>    "$ENV{ProgramFiles}/boost"
>    /sw/local/lib
>  )
>
> Boost installed to here for me:
> c/Program\ Files/boost/boost_1_38/
>
> So the extra _${Boost_SUBMINOR_VERSION} is breaking the find.    
> CMake is looking in boost_1_38_0.   Is that a special case for 0?  I  
> don't think both will hurt, so I guess I can check this in.
>
>
>
> -Bill


<sarcasm>Well, of course the trailing _0 is special. Why be consistent  
</sarcasm>

Boost uses the following version scheme:

If the sub minor version is "0" then leave it off all versions. If the  
subminor version is NOT zero then add it on. So for versions like  
1.38.1 FindBoost will work just fine. But for 1.38 (the current  
version), then it simply will not find boost.


And for the rest of us that install into non-standard locations, we  
set "BOOST_ROOT" so FindBoost.cmake will work.

Sure, check it in. Looks good.

Mike

PS: One of these days I'm going to add in a pile of debug statements  
so when boost can not be found full listings of where and what it is  
looking for can be printed. One of these days..





More information about the CMake mailing list