On 5/26/10 11:52 AM, Nico Schlömer wrote:
Hi all,
I'd like to use CMake for an application that I'm developing on an
Ubuntu machine which needs to link against Boost, i.e., a
custom-compiled installation at /opt/boost/1.43.0/.
I compiled and installed CMake 2.8.1, FindBoost.cmake comes in handy.
Ubuntu ships with its own Boost development package (1.40.0) which I
cannot remove because it's used by other packages. By default, CMake
finds the stock-Boost (I guess b/c it sits in those default folders),
so I call cmake with
cmake -DBOOST_ROOT:PATH=/opt/boost/1.43.0/ /path/to/source/
Boost is found, and the variables are set in CMakeCache.txt, e.g.,
Boost_INCLUDE_DIR:PATH=/opt/boost/1.43.0/include
I however also notice that the actual libraries are *not* set correctly, as
Boost_FILESYSTEM_LIBRARY:FILEPATH=/usr/lib/libboost_filesystem-mt.so
This makes the build fail. Setting BOOST_LIBRARYDIR does not help.
Strangely, I ran into this same problem last night; it seems as if
FindBoost.cmake caches a little *too* aggressively. In particular, I
find that if I want to be able to override the default (system) boost
interactively from any of the CMake guis, I have to do the following in
my listfile:
set(BOOST_INCLUDEDIR "" CACHE PATH "")
set(BOOST_LIBRARYDIR "" CACHE PATH "")
find_package(Boost COMPONENTS foo bar baz REQUIRED)
... which will detect the default boost the first time I configure. If
I want to use a different boost install, I have to do the following:
* Set BOOST_INCLUDEDIR and BOOST_LIBRARYDIR to my desired boost
* Delete *all* remaining cached Boost_XXXX variables.
* Reconfigure
If I don't delete every Boost_XXXX variable, I'll end-up with
permutations of new and old locations.
Cheers,
Tim
--
Timothy M. Shead
Sandia National Laboratories
1424, Data Analysis and Visualization
_______________________________________________
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