I tried everything like:
sudo apt-get install libb
Try to complete cmake process with following libs:
sudo apt-get install cmake libblkid-dev e2fslibs-dev libboost-all-dev libaudit-dev
I had the same issue inside an alpine docker container, my solution was to add the boost-dev apk library because libboost-dev was not available.
I just want to point out that the FindBoost macro might be looking for an earlier version, for instance, 1.58.0 when you might have 1.60.0 installed. I suggest popping open the FindBoost macro from whatever it is you are attempting to build, and checking if that's the case. You can simply edit it to include your particular version. (This was my problem.)
seems the answer is in the comments and as an edit but to clarify this should work for you:
export BUILDDIR='your path to build directory here'
export SRCDIR='your path to source dir here'
export BOOST_ROOT="/opt/boost/boost_1_57_0"
export BOOST_INCLUDE="/opt/boost/boost-1.57.0/include"
export BOOST_LIBDIR="/opt/boost/boost-1.57.0/lib"
export BOOST_OPTS="-DBOOST_ROOT=${BOOST_ROOT} -DBOOST_INCLUDEDIR=${BOOST_INCLUDE} -DBOOST_LIBRARYDIR=${BOOST_LIBDIR}"
(cd ${BUILDDIR} && cmake ${BOOST_OPTS} ${SRCDIR})
you need to specify the arguments as command line arguments or you can use a toolchain file for that, but cmake will not touch your environment variables.
Thanks Paul-g for your advise. For my part it was a bit different.
I installed Boost by following the Step 5 of : https://www.boost.org/doc/libs/1_59_0/more/getting_started/unix-variants.html
And then I add PATH directory in the "FindBoos.cmake", located in /usr/local/share/cmake-3.5/Modules :
SET (BOOST_ROOT "../boost_1_60_0") SET (BOOST_INCLUDEDIR "../boost_1_60_0/boost") SET (BOOST_LIBRARYDIR "../boost_1_60_0/libs") SET (BOOST_MIN_VERSION "1.55.0") set (Boost_NO_BOOST_CMAKE ON)
Long answer to short, if you install boost in custom path, all header files must in ${path}/boost/.
if you want to konw why cmake can't find the requested Boost libraries after you have set BOOST_ROOT/BOOST_INCLUDEDIR
, you can check cmake install location path_to_cmake/share/cmake-xxx/Modules/FindBoost
.
cmake which will find Boost_INCLUDE_DIR
in boost/config.hpp
in BOOST_ROOT
. That means your boost header file must in ${path}/boost/
, any other format (such as ${path}/boost-x.y.z
) will not be suitable for find_package
in CMakeLists.txt.