1

i have a problem with boost 1.54.

At the moment i have my main.cpp and when i output my boost version i tells me 1.54 that is fine. I get this with

LD_LIBRARY_PATH=/path/boost_1_54_0:${LD_LIBRARY_PATH}
export LD_LIBRARY_PATH
LD_LIBRARY_PATH=/path/boost_1_54_0/stage/lib:${LD_LIBRARY_PATH}
export LD_LIBRARY_PATH 
CPLUS_INCLUDE_PATH=/path/boost_1_54_0:${CPLUS_INCLUDE_PATH}
export CPLUS_INCLUDE_PATH

the problem is when i said to my Cmake

find_package(Boost 1.54.0 COMPONENTS system log REQUIRED)

instead of

find_package(Boost COMPONENTS system log REQUIRED)

i get an error that the newest version is 1.46 my system version. So my Cmake didnt found the right boost path.

What is the correct way to give this path to cmake?

set(Boost_ADDITIONAL_VERSIONS "1.54.0" )
set(BOOST_ROOT path/boost_1_54_0)
set(BOOST_INCLUDEDIR path/boost_1_54_0)
set(BOOST_LIBRARYDIR path/boost_1_54_0/lib)

i tried this but it isn't working.

The reason for changing this running system is that i want to use Boost log and when i start the trivial example i get

undefined reference to `boost::log::v2_mt_posix::trivial::logger::get()'

but this problem is solved here

Boost.Log with CMake causing undefined reference error

But for this solving i need the correct boost version on CMAKE

thank you for your help and sry i am really new on using cmake

Community
  • 1
  • 1
Hunk
  • 479
  • 11
  • 33

1 Answers1

3

The FindBoost script provides an option Boost_NO_SYSTEM_PATHS that will prevent it from detecting the 1.46 version installed by the system. You probably want to set this from the command line instead of the CMake script itself to keep your build system portable.

After that, simply provide a BOOST_ROOT with the path to Boost 1.54 as hint (preferably in the form of a system environment variable) and it should work. Don't forget to clear your CMake cache of any previous search results after making a change like this.

ComicSansMS
  • 51,484
  • 14
  • 155
  • 166
  • thank you for your fast answer. Boost RooT is working now and he found my path/boost_1.54_0 , inside this folder i have my boost directory with my files. The problem now is with #include he cant find this file. Have i set the boost include path separately ? Or what can be the problem for that? I tried to add geometry on find_package(Boost 1.54.0 REQUIRED COMPONENTS system log geometry ) but he didnt found. I have no idea why i dont get the geometry.hpp now becuase she is in path/boost_1_54_0/boost/geometry.hpp do you have an idea? – Hunk Oct 28 '13 at 09:06
  • @Hunk Check the value of `Boost_INCLUDE_DIR` in the CMake cache. Does it point to the expected directory? Then make sure you actually use that value and correctly add it to the include path in CMake. Check the documentation for `FindBoost` to understand the directory layout that is expected by the find script to locate the files. – ComicSansMS Oct 28 '13 at 09:27
  • i checked the value of Boost_INClUDE_DIR and it point to the right directory. Where i can find the directory layout for FindBoost ? But i dont think that this is the problem because as include directory it tell me path/boost_1_54_0 and on this directory i have a boost directory which includes the header files. So this should be correct. I dont really understand why he cant find this files – Hunk Oct 28 '13 at 10:20
  • i wrote an output for my directories status** Boost Include: path/boost_1_54_0 status** Boost Libraries: path/boost_1_54_0/stage/lib status** Boost Libraries: path/boost_1_54_0/stage/lib/libboost_system.so – Hunk Oct 28 '13 at 10:24
  • @Hunk Do you do an `include_directories(${Boost_INCLUDE_DIRS})` in your CMakeLists? – ComicSansMS Oct 28 '13 at 10:25
  • thank you very much i removed it because i tested something else and forget it ... – Hunk Oct 28 '13 at 10:51