[CMake] cmake, boost on windows, and linking: shouldn't find_package have put BOOST_ROOT/lib into LIB?

Dan Kegel dank at kegel.com
Fri Oct 28 22:11:32 EDT 2011


I'm slowly learning cmake and converting some real software to it,
targeting Linux, Windows, and Mac OS X.
Along the way, I'm making minimal working examples (they're a lot
easier to debug them than the real thing) and putting them up at
http://code.google.com/p/winezeug/source/browse/#svn/trunk/cmake_examples

Today, I wrote an example that uses a single function from boost.  It's at
  http://code.google.com/p/winezeug/source/browse/#svn%2Ftrunk%2Fcmake_examples%2Fex4

For Linux, demo.sh builds and runs the example, assuming you've
installed everything needed with apt-get.
For Windows (or Linux with Wine), demo.bat builds and runs the
example, assuming you've installed visual c++ 2005 express, the win 7
platform sdk, and boostpro.com's pre-build boost (the whole thing,
don't skip any libraries, or you may be mystified why things don't
link, like I was).    It sets BOOST_ROOT so find_package can find
boost.

And now the question.
I needed to put $BOOST_ROOT/lib into the LIB environment variable by
hand (well, by running
http://code.google.com/p/winezeug/source/browse/trunk/cmake_examples/settings.bat
).
If I leave it out, I get the error
LINK : fatal error LNK1104: cannot open file
'libboost_date_time-vc80-mt-gd-1_47.lib'
when bulding on Windows.
Shouldn't find_package have taken care of that?


More information about the CMake mailing list