[CMake] Boost on Windows

Christopher Harvey chris at basementcode.com
Tue Jun 23 15:44:55 EDT 2009


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.

Curtis Rueden wrote:
> 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
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> 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



More information about the CMake mailing list