0
votes

I need to use custom build of boost lib, which uses own library naming prefix as well as namespace in the code.

I need to link with it in CMakeLists.txt:

set(BOOST_INCLUDEDIR /path/to/custom/boost/include)
set(BOOST_LIBRARYDIR /path/to/custom/boost/lib)
set(BOOST_NAMESPACE my_boost_161)
set(Boost_NO_SYSTEM_PATHS OFF)

set (Boost_USE_STATIC_LIBS OFF)
find_package (Boost REQUIRED COMPONENTS my_unit_test_framework)
include_directories (${Boost_INCLUDE_DIRS})

the libraries have a names like :

libmy_boost_161_unit_test_framework.so

and really exist in lib folder

there is a errors like:

CMake Error at /home/user1/.localcmake/share/cmake-3.14/Modules/FindBoost.cmake:2132 (message): Unable to find the requested Boost libraries.

Boost version: 1.61.0

Boost include path:
/path/to/custom/boost/include

Could not find the following Boost libraries:

      boost_unit_test_framework

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

How can I specify to look for libs with names like (my_ addition to standard names): similar to Boost_LIB_VERSION which gives an ability to add the version to lib name

my_boost_161_unit_test_framework

1
Message Could not find the following Boost libraries: contains logical name of the library. For find, which filename is searching, pass -DBoost_DEBUG=ON option to cmake.Tsyvarev
thank you very much for the flag, it shows me detailed info and I could find required flags and solve my problem. Boost_LIB_PREFIX and Boost_NAMESPACE are helpful for my issueamigo421
@amigo421 If your issue was solved, please consider writing an answer post so others know how you solved it. And mark it as accepted.squareskittles

1 Answers

1
votes

This addition to the CMake script fixes the problem:

...
set(Boost_NO_SYSTEM_PATHS OFF)

set(Boost_LIB_PREFIX my_boost_161)
set(Boost_NAMESPACE my_boost_161)

set(Boost_USE_STATIC_LIBS OFF)
...