I am trying to use boost thread for my project in a Ubuntu machine. I download boost 1.58.0 via apt-get in ubuntu and use Cmake for building the c++ project.
In my CMakeLists.txt, I have
find_package(Boost 1.58.0 REQUIRED)
include_directories( ${Boost_INCLUDE_DIR} )
message(STATUS "Boost_INCLUDE_DIR: ${Boost_INCLUDE_DIR}")
message(STATUS "Boost_LIBRARIES: ${Boost_LIBRARIES}")
target_link_libraries( Sparse3D ${COLMAP_LIBRARIES} )
It turns out Cmake can't find the boost library
-- Boost_INCLUDE_DIR: /usr/include
-- Boost_LIBRARIES:
I then checked online and figured out that I may need to specify the library, and changed the CMakeLists.txt to
find_package(Boost 1.58.0 COMPONENTS system filesystem thread REQUIRED)
But CMake can't find boost_thread. Here is the CMake output:
-- Found Glew
-- Includes : /usr/include
-- Libraries : /usr/lib/x86_64-linux-gnu/libGLEW.so
-- __cplusplus is 201103
-- --> Do not link with Boost.Thread
-- Boost version: 1.58.0
-- Boost include dirs: /usr/include
-- Boost libraries:
CMake Error at /usr/share/cmake-3.5/Modules/FindBoost.cmake:1677 (message):
Unable to find the requested Boost libraries.
Boost version: 1.58.0
Boost include path: /usr/include
Could not find the following Boost libraries:
boost_thread
Some (but not all) of the required Boost libraries were found. You may
need to install these additional Boost libraries. Alternatively, set
BOOST_LIBRARYDIR to the directory containing Boost libraries or BOOST_ROOT to the location of Boost.
Call Stack (most recent call first):
CMakeLists.txt:20 (find_package)
-- GLM_INCLUDE_DIR = /usr/local/include
-- GLM included at /usr/local/include
-- Boost_LIBRARIES: /usr/include
-- Boost_LIBRARIES:
But libboost_thread.so.1.58.0 does exist in /usr/lib/x86_64-linux-gnu. Thank you all in advance.