[CMake] Boost on Windows

Michael Jackson mike.jackson at bluequartz.net
Tue Jun 23 16:30:56 EDT 2009


On Jun 23, 2009, at 4:17 PM, Curtis Rueden wrote:

> Hi Mike,
>
> I use the boost pre-compiled all the time and I don't have any of  
> these issues BUT I do set the BOOST_ROOT environment variable in "My  
> Computer->Advanced Settings" after I install which may be the  
> difference. I use threads, program_options, testing, filesystem and  
> system.
>
> Yes, the problem is that I do not explicitly set BOOST_ROOT.
>
> I did notice in the FindBoost that there is a subtle difference in  
> how the directory names are generated:
>
> I think one has boost_1_38 while another has boost-1_38 depending on  
> windows or unix.
>
> From FindBoost.cmake in CMake version 2.6.4 around line 460
>
>
> list(APPEND _boost_PATH_SUFFIXES "boost-${_boost_BOOSTIFIED_VERSION}")
> if(WIN32)
> # For BoostPro's underscores (and others?)
>  list(APPEND _boost_PATH_SUFFIXES "boost_$ 
> {_boost_BOOSTIFIED_VERSION}")
> endif()
>
> Interesting; I used the BoostPro installer so it is indeed all  
> underscores (boost_1_38).
>
> Do you actually have the Dynamic multi-threaded boost libs installed?
>
> Yep, I have all types (single threaded vs. multi-threaded, static  
> vs. shared) installed.
>
> Also, Looking at the CMakeLists.txt file it seems you are trying to  
> parse the Boost_THREAD library variable for something? If you are  
> trying to differentiate between the Release and Debug versions there  
> are the following variables for each boost library.
>
> Boost_PROGRAM_OPTIONS_LIBRARY
> Boost_PROGRAM_OPTIONS_LIBRARY_DEBUG
> Boost_PROGRAM_OPTIONS_LIBRARY_RELEASE
>
> Any of that help?
>
> Thanks, I didn't know about Boost_THREAD_LIBRARY_DEBUG. That helps  
> me eliminate a little bit of code.
>
> Anyway, Arnaud Gelas and I took a look at FindBoost.cmake, and  
> discovered the problem. FIND_PATH is called to populate  
> Boost_INCLUDE_DIR, but not until line 478 (CMake 2.6-patch4),  
> whereas the components are checked before that (e.g., around line  
> 303 there is an "IF(Boost_INCLUDE_DIR)" block that never executes).
>
> Andreas, shouldn't FIND_PATH be called right away, and once the  
> Boost_INCLUDE_DIR is known, then subsequently check for individual  
> components of Boost?

I think the conditional is if Boost_INCLUDE_DIR is _already_ in the  
cache because FindPackage(Boost.. ) has already been called once then  
this will short-circuit some of the tests so things go a bit  
quicker .. (I think).

Yes you are correct. FindBoost.cmake probably should be able to find  
BoostPro's _default_ installation without a problem. Patches are  
welcome ;-).

Mike



More information about the CMake mailing list