Target links to target "Boost::thread" but the target was not found
I have pre-compiled Boost 1.70 library which I want to link to its threads.
I'm finding the boost library using this cmake code:
set(Boost_NO_BOOST_CMAKE YES)
set(Boost_NO_SYSTEM_PATHS ON)
set(BOOST_ROOT opt/boost/arch/x86)
find_package(Boost REQUIRED COMPONENTS thread)
Then when I tried on same CMakeLists.txt to link to boost threads using:
target_link_libraries(boost_interface INTERFACE Boost::thread)
I get the next error: Target "..." links to target "Boost::thread" but the target was not found. Perhaps a find_package() call is missing for an IMPORTED target, or an ALIAS target is missing?
Now, if I'm linking there instead to ${Boost_LIBRARIES}
I got no error, but I link to all boost libs.
I want to link only to the specific thread so file of Boost.
What am I doing wrong?
cmake version is 3.10.2 and same is the cmake minimum required on my top.