[CMake] Boost on Windows

Curtis Rueden ctrueden at wisc.edu
Tue Jun 23 16:17:21 EDT 2009


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?

-Curtis

On Tue, Jun 23, 2009 at 2:21 PM, Michael Jackson <
mike.jackson at bluequartz.net> wrote:

> 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.
>
> 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()
>
> Do you actually have the Dynamic multi-threaded boost libs 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?
>
> _________________________________________________________
> Mike Jackson                  mike.jackson at bluequartz.net
> BlueQuartz Software                    www.bluequartz.net
> Principal Software Engineer                  Dayton, Ohio
>
>
>
>
> On Jun 23, 2009, at 1:35 PM, Curtis Rueden wrote:
>
>  Hi Andreas,
>>
>> Well, then most probably the layout of that binary installation differs
>> from what the FindBoost.cmake file expects. So where is the boost thread
>> library and how is it named?
>>
>> The latest available version of Boost offered by BoostPro is v1.38. The
>> libraries are placed in:
>>
>>  C:\Program Files\boost\boost_1_38\lib
>>
>> The strange thing is that FindBoost *does* find Boost, but only if first
>> run with no arguments, followed by explicitly setting BOOST_ROOT.
>>
>> Looking at this:
>>
>> >
>> https://skyking.microscopy.wisc.edu/svn/java/trunk/components/native/bf-cpp/CMakeLists.txt
>>
>> The layout of that package seems to be utterly broken.
>>
>> Do you mean bf-cpp, or some other package? How is it "broken"? I am new to
>> the CMake way of doing things, so would appreciate any advice for
>> improvement.
>>
>> Thanks,
>> Curtis
>>
>> On Tue, Jun 23, 2009 at 1:26 PM, Andreas Pakulat <apaku at gmx.de> wrote:
>> On 23.06.09 13:09:25, Curtis Rueden wrote:
>> > First, I installed Boost using BoostPro's precompiled binaries at
>> > http://www.boostpro.com/download.
>> >
>> > Then I tried the following CMakeLists.txt file:
>> >
>> > ----------
>> > # Simple CMake build file for testing FindBoost. Fails on Windows with
>> > # Boost binaries from BoostPro computing (http://www.boostpro.com/).
>> >
>> > cmake_minimum_required(VERSION 2.6)
>> >
>> > project(boostFail1)
>> >
>> > message(STATUS "-- Boost:")
>> > set(Boost_USE_STATIC_LIBS OFF)
>> > set(Boost_USE_MULTITHREAD ON)
>> >
>> > find_package(Boost COMPONENTS thread REQUIRED)
>> >
>> > message(STATUS "Boost_INCLUDE_DIR    : ${Boost_INCLUDE_DIR}")
>> > message(STATUS "Boost_THREAD_LIBRARY : ${Boost_THREAD_LIBRARY}")
>> > ----------
>> >
>> > The error message I see is:
>> >
>> > ----------
>> > -- Boost:
>> > CMake Error at C:/Program Files/CMake
>> > 2.6/share/cmake-2.6/Modules/FindBoost.cmake:868 (message):
>> >   Unable to find the requested Boost libraries.
>> >
>> >   Boost version: 1.38.0
>> >
>> >   Boost include path: C:/Program Files/boost/boost_1_38
>> >
>> >   The following Boost libraries could not be found:
>> >
>> >           boost_thread
>> >
>> >   No Boost libraries were found.  You may need to set Boost_LIBRARYDIR
>> to
>> > the
>> >   directory containing Boost libraries or BOOST_ROOT to the location of
>> >   Boost.
>> > Call Stack (most recent call first):
>> >   CMakeLists.txt:16 (find_package)
>> >
>> >
>> > Boost_INCLUDE_DIR    : C:/Program Files/boost/boost_1_38
>> > Boost_THREAD_LIBRARY : Boost_THREAD_LIBRARY-NOTFOUND
>> > ----------
>> >
>> > The problem does not occur on Linux or Mac OS X.
>>
>> Well, then most probably the layout of that binary installation differs
>> from what the FindBoost.cmake file expects. So where is the boost thread
>> library and how is it named? Looking at this:
>>
>> >
>> https://skyking.microscopy.wisc.edu/svn/java/trunk/components/native/bf-cpp/CMakeLists.txt
>>
>> The layout of that package seems to be utterly broken.
>>
>> Andreas
>>
>>
>>
> _______________________________________________
> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20090623/88a3d73c/attachment-0001.htm>


More information about the CMake mailing list