[CMake] How to include Boost in Visual Studio cmake project

Martin Peter Christiansen martin.p.christiansen at gmail.com
Thu Nov 12 05:43:34 EST 2009


I just tried the advise I was given, and the result was the following

C:\local\workspace\RobWork\build\release>cmake -G "Visual Studio 9 2008"
-DCMAKE_BUILD_TYPE=Release ../..
-- RobWork version 0.4.0
-- Build configuration: Release
--  No Default.cmake file loaded, using default settings from
config.cmake.template
CMake Warning (dev) at CMakeLists.txt:20 (INCLUDE):
  Policy CMP0011 is not set: Included scripts do automatic cmake_policy PUSH
  and POP.  Run "cmake --help-policy CMP0011" for policy details.  Use the
  cmake_policy command to set the policy and suppress this warning.
  The included script
    C:/local/workspace/RobWork/build/ProjectSetup.cmake
  affects policy settings.  CMake is implying the NO_POLICY_SCOPE option for
  compatibility, so the effects are applied to the including context.
This warning is for project developers.  Use -Wno-dev to suppress it.
-- RobWork ROOT dir: C:/local/workspace/RobWork
CMake Error at C:/Programmer/CMake
2.8/share/cmake-2.8/Modules/FindBoost.cmake:879 (message):
  Unable to find the requested Boost libraries.
  Boost version: 1.39.0
  Boost include path: C:/local/boost/include/boost-1_39
  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):
  build/depends.cmake:8 (FIND_PACKAGE)
  build/RobWorkSetup.cmake:32 (INCLUDE)
  CMakeLists.txt:36 (INCLUDE)


When I was building boost this time, I did ran the following commands:
- "C:\Downloads\boost_1_39_0>bjam.exe --prefix=C:\local\boost -toolset=msvs
define="_SECURE_SCL=0" define="_HAS_ITERATOR_DEBUGGING=0" -d+2"
- "C:\Downloads\boost_1_39_0>bjam.exe install --prefix=C:\local\boost"

I removed all the old enviromental variables for boost and created the
following variable
-  BOOST_ROOT = C:\local\boost

In "C:\local\boost\lib" I have
- libboost_thread-vc90-mt.lib
- libboost_thread-vc90-mt-gd-1_39.lib
- libboost_thread-vc90-mt-gd.lib

In "C:\local\boost\include\boost-1_39" I have
 - A folder named "boost", but no subfolder or file called "boost_thread"

I must missing some variable or setting, but I can't figure out what...

Regards

Martin Peter Christansen


2009/11/12 Mike Jackson <mike.jackson at bluequartz.net>

> Usually when I build Boost on Windows I use the
> --prefix=C:\Path\To\Boost and the "install" target instead of the
> stage target.
>
> Then I set BOOST_ROOT to what ever I set the --prefix argument to.
> That seems to always work.
>
> And to try this out you will need a clean RobWork build directory. So,
> to sum up, try rebuilding boost by including the --prefix=C:\.... and
> "install" arguments to bjam.
>
> Then remove everything from your RobWork build directory and then
> reconfigure RobWork using cmake.
> _________________________________________________________
> Mike Jackson                  mike.jackson at bluequartz.net
> BlueQuartz Software                    www.bluequartz.net
> Principal Software Engineer                  Dayton, Ohio
>
>
>
>
> On Wed, Nov 11, 2009 at 7:41 PM, Martin Peter Christiansen
> <martin.p.christiansen at gmail.com> wrote:
> > For the last day or so I have tried to compile a project(RobWork) for
> Visual
> > Studio 2008 using Cmake.
> >
> > But my problem is that Cmake claims i can't find Boost dependencies.
> >
> >
> >
> > I have been googling the problem on the net, but the only answer I could
> > find was that FindBost.cmake was the problem, but not how to solve it.
> >
> >
> >
> > When i run the project (RobWork) i get the following error:
> >
> >
> >
> >  C:\Documents and Settings\Martin>cd
> > c:\local\workspace\RobWork\build\release
> >
> > C:\local\workspace\RobWork\build\release>cmake -G "Visual Studio 9 2008"
> > -DCMAKE_BUILD_TYPE=Release
> > ../..
> > -- RobWork version 0.4.0
> > -- Build configuration: Release
> > CMake Warning (dev) at CMakeLists.txt:20 (INCLUDE):
> >   Policy CMP0011 is not set: Included scripts do automatic cmake_policy
> PUSH
> >   and POP.  Run "cmake --help-policy CMP0011" for policy details.  Use
> the
> >   cmake_policy command to set the policy and suppress this warning.
> >
> >   The included script
> >
> >     C:/local/workspace/RobWork/build/ProjectSetup.cmake
> >
> >   affects policy settings.  CMake is implying the NO_POLICY_SCOPE option
> for
> >   compatibility, so the effects are applied to the including context.
> > This warning is for project developers.  Use -Wno-dev to suppress it.
> >
> > -- RobWork ROOT dir: C:/local/workspace/RobWork
> > CMake Error at C:/Programmer/CMake
> > 2.8/share/cmake-2.8/Modules/FindBoost.cmake:879 (message):
> >   Unable to find the requested Boost libraries.
> >
> >   Boost version: 1.39.0
> >
> >   Boost include path: C:/local/boost_1_39_0
> >
> >   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):
> >   build/depends.cmake:8 (FIND_PACKAGE)
> >   build/RobWorkSetup.cmake:32 (INCLUDE)
> >   CMakeLists.txt:36 (INCLUDE)
> >
> >
> >
> > - I have successfully compiled Boost 1.39.0 to Visual studio 2008, so i
> get
> > lib files like "libboost_date_time-vc90-mt-1_39.lib" in
> > <boost-root>/stage/lib.
> >
> >
> >
> > - Boost have been placed in “C:\local\boost_1_39_0”
> >
> >
> >
> > - The following environment variables has been added to Windows
> BOOST_ROOT =
> > C:\local\boost_1_39_0 and BOOST_LIBRARYDIR = $BOOST_ROOT\stage\lib
> >
> >
> >
> > - Both Cmake 2.6 and 2.8r2 have been used to compile the project, with no
> > success.
> >
> >
> >
> >
> >
> > What I need is a solution, which can help me compile this project using
> > Visual Studio 2008
> >
> >  Is there some way I can setup FindBoost.cmake, so it will accept and
> boost
> > correctly????
> >
> >
> >
> > Regards
> >
> >
> >
> > Martin Peter Christiansen
> >
> >
> >
> > _______________________________________________
> > 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/20091112/68854c6a/attachment-0001.htm>


More information about the CMake mailing list