- Make sure you created a symlink for the include directory. By default boost puts its includes under boost-X.YY (e.g. boost-1.39). Just ln -s boost-1_39/boost boost and away you go. Not sure how things work on Win32, but if you need to symlink remember: junction.exe is your friend.
- Set BOOST_ROOT and only BOOST_ROOT. When things fail to work you may be lured into thinking that artifacts such as Boost_LIBRARY_DIRS or Boost_INCLUDE_DIRS or others of such ilk (BOOST_LIBRARY_DIRS, BOST_LIBRARYDIRS, etc.) may actually help you. How wrong you are. All you need is to get BOOST_ROOT right. To do so, simply point it to the top level directory where you installed boost. For instance, I've placed boost under ~/local. Your BOOST_ROOT is set correctly when ${BOOST_ROOT}/include/boost and ${BOOST_ROOT}/lib exist.
set(BOOST_ROOT /home/marco/local)
find_package(Boost 1.36 REQUIRED COMPONENTS system thread serialization filesystem)
...
include_directories(${INCLUDE_DIR} ${Boost_INCLUDE_DIRS})
link_directories(${Boost_LIBRARY_DIRS})
...
target_link_libraries(${YOUR_BINARY} ${Boost_LIBRARIES})
That simple. Of course, one must not forget to change this before giving this to anyone else - you should be checking the regular directories where boost gets installed.
No comments:
Post a Comment