[CMake] Boost on Windows

Curtis Rueden ctrueden at wisc.edu
Tue Jun 23 13:09:25 EDT 2009


Hi everyone,

I am using CMake to build some code cross-platform. This code requires Boost
Thread to compile. I am having several problems with FindBoost on Windows.

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.

I can work around the problem by calling find_package(Boost) with no
arguments, setting BOOST_ROOT accordingly, and then calling
"find_package(Boost COMPONENTS thread REQUIRED)" but it seems odd to need to
do that. Any thoughts?

A full, working CMakeLists.txt for my project can be seen at:


https://skyking.microscopy.wisc.edu/svn/java/trunk/components/native/bf-cpp/CMakeLists.txt

Over half of the lines of code are specifically for dealing with Boost,
particularly on Windows; it would be nice to trim down the configuration a
bit.

Thanks,
Curtis
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20090623/a787cf2b/attachment.htm>


More information about the CMake mailing list