I'm trying to add Boost to my C++ project using CMake but it refuses to find Boost libraries eventhough I am 100% sure they are there.
Error:Unable to find the requested Boost libraries.
Boost version: 1.61.0
Boost include path: C:/Program Files (x86)/boost_1_61_0
Could not find the following Boost libraries:
boost_system
No Boost libraries were found. You may need to set BOOST_LIBRARYDIR to the directory containing Boost libraries or BOOST_ROOT to the location of Boost.
This is what my search looks like in CMake.
FIND_PACKAGE(Boost REQUIRED COMPONENTS system)
IF (Boost_FOUND)
INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIR})
ADD_DEFINITIONS( "-DHAS_BOOST" )
ENDIF()
I have tried to set all of the paths manually but nothing changes and it keeps telling me no libraries could be found.
EDIT: To clarify, if I remove "COMPONENTS system" it will not error but crash on the build, giving
"undefined reference to `boost::system::generic_category()'"
, etc.
EDIT 2: I want to clarify a bit more, I am able to use header only parts of boost, but I cannot use anything else, as it will give me the undefined reference error. I searched Stackoverflow for that error, and the solution was adding the "COMPONENTS system" part to find_package, and that's where it goes wrong.