0

I'm able to build Boost on Linux but am having a hard time getting the include path to be properly set up. When I'm done compiling, I get the following message:

The Boost C++ Libraries were successfully built!

The following directory should be added to compiler include paths:

    /<networkpath>/BOOST/boost_1_80_0        ** Note the lack of an /include here!
    
The following directory should be added to linker library paths:

    /<networkpath>/BOOST/boost_1_80_0/lib    ** Correct

The problem is that every CMakeFile produced now has the following:

get_filename_component(_BOOST_INCLUDEDIR "${_BOOST_CMAKEDIR}/../.." ABSOLUTE)   ** Again, no /include.
get_filename_component(_BOOST_LIBDIR "${_BOOST_CMAKEDIR}/../" ABSOLUTE)         ** Correct

My command line for building Boost is as follows:

b2 --build-dir=builds --stagedir=../boost_1_80_0 toolset=gcc --without-python

I needed to add the custom "stagedir" location to get _BOOST_LIBDIR to be correct in the CMakeFiles.

I've rebuilt this many times trying various command line options and folder structures but haven't been able to get the /include path to be set correctly. Any ideas are appreciated.

Additional info:

b2 intall command line:

 ./b2 install --prefix=<networkPath>/<accountName>/BOOST/boost_1_80_0/tools/build/BoostBuild

I'm not installing the libraries, just building them and moving them to a different location. The part that confuses me is that when the libraries are built, every library has auto-generated CMakeFiles with the paths to the lib and include directories. Since this happens before install, I haven't found where these are set as part of the build.

jslmsca
  • 196
  • 1
  • 14
  • 1
    You seem to be missing the `--prefix` option as well as a call to `b2 install`. ( see https://www.boost.org/doc/libs/1_83_0/more/getting_started/unix-variants.html#easy-build-and-install ). Make sure you not only build boost but also install it to a directory of your choice (or to a global dir). Then you should be able to add the boost install root to `CMAKE_PREFIX_PATH` and use `find_package(Boost REQUIRED COMPONENTS unit_test_framework CONFIG)`; after that e.g. `target_link_libraries(foo PRIVATE Boost::unit_test_framework)` should apply all the necessary settings to your target `foo` – fabian Aug 26 '23 at 10:59
  • I've added the b2 install command line to the question. I run ./bootsrap.sh first, then the b2 install command line, update my $PATH environment variable to point to the prefix location where the \bin folder exists for b2. I also update my $PATH environment variable to include a path to a custom version of gcc. Added more information to the question... – jslmsca Aug 27 '23 at 17:58

0 Answers0