Boost header files are on /usr/include/boost.
In CMakeLists.txt I include the folder with include_directories
include_directories(/usr/include /usr/include/boost/
/usr/include/boost/smart_ptr)
However, cmake insists in not finding header files. The problem arises in intrusive_ptr.hpp, which includes #include <boost/smart_ptr/intrusive_ptr.hpp:
boost/smart_ptr/intrusive_ptr.hpp: No such file or directory
/usr/include/boost/intrusive_ptr.hpp
My guess is it does not like boost/smart_ptr/ prefix.
So, include_directories did not work.
CMake Error:
CMake Error at /usr/local/share/cmake-3.3/Modules/FindBoost.cmake:1245
(message):
Unable to find the requested Boost libraries.
Unable to find the Boost header files. Please set BOOST_ROOT to the root
directory containing Boost or BOOST_INCLUDEDIR to the directory containing
Boost's headers.
What should I do?
Thanks.
While I do not know what failed in your case, I'd recommend to simply use find_package with the included FindBoost.cmake file:
find_package(Boost REQUIRED)
include_directories(${Boost_INCLUDE_DIRS})
Done
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With