10

I've downloaded, extracted, and compiled the Boost libraries (including the separately compiled libraries). I've used their install procedure a couple times now but I can't seem to get it to do exactly what I want. Right now, when I install Boost after compiling it goes to

C:\Boost

This is fine. The compiled libs go to

C:\Boost\lib

which is also fine. The problem I have is with the installation of the precompiled headers. They got put at

C:\Boost\include\boost-1_54\boost

Is there a way to use the Boost build system and install tools to set the precompiled headers to be installed to just

C:\Boost\include

and not have the Boost version number be a part of that folder hierarchy?

I don't plan on using multiple versions of Boost at the same time so I don't have a use for actually having that version number. I realize I could move them manually after the install is complete, but I wanted to see first if I've overlooked or misunderstood something about Boost's build system.

6
  • 1
    What commands do you invoke when building boost? What "precompiled headers" do you mean?
    – Igor R.
    Sep 11, 2013 at 5:19
  • I ran bootstrap and then .\b2 -j8 --prefix=C:\Boost --libdir=C:\Boost\lib --includedir=C:\Boost\include install. The precompiled headers are the hpp files that don't require compilation to be used, the files that go in the include directory.
    – CraigularB
    Sep 11, 2013 at 5:36
  • 2
    I see. What do you get if you add --layout=system?
    – Igor R.
    Sep 11, 2013 at 5:46
  • So that got me closer. In order to use --layout=system I also had to specify which variant I was building (I decided to default to release for now) in order to prevent filename clashing on the libs. The problem is the include directory still looks like C:\Boost\include\boost\[all hpp files]. Is there any way to get rid of that second "boost" in the path? EDIT Sorry, I just realized I mistyped one of the options on the prompt. I'll try one more time. EDIT 2 Ok, I've fixed the command line issue but it's still adding that second Boost in the path.
    – CraigularB
    Sep 11, 2013 at 14:28
  • Well, with Boost.Build you can do virtually anything, but this going to be not so trivial. I guess you'll have to customize your target using user-config.jam file (boost.org/doc/display_build.php/boost-build/boost-build/doc/…). Besides, try posting to boost-users ML.
    – Igor R.
    Sep 11, 2013 at 19:59

1 Answer 1

1

--layout=system removes the versioned subdirectory from the include path (as @IgorR. pointed out).

"Removing that second boost in the path" is a bad idea. In a respectable OS (cough...), the include files for various libraries are supposed to co-exist in one common include directory, hence the boost subdirectory to avoid clashes. Boost headers are therefore habitually referred to as e.g. #include <boost/any.hpp>, i.e. including that boost/ subdirectory.

This is done both by third-party software using Boost, and by Boost itself. If you remove the second boost from the path, you would end up with C:\Boost\include\any.hpp, and any Boost-using software won't compile as not even Boost could find its own includes.

3
  • 1
    I know this question is ancient, but it looked so lonely without answer...
    – DevSolar
    Jul 4, 2017 at 14:32
  • --layout=system fails build when I compile both debug|release versions... Still looking for an answer. Apr 3, 2019 at 14:52
  • 1
    Try --layout=tagged. It removes extra version subfolder, but generates lib names like libboost_system-mt-x64.lib to avoid name clashing.
    – cos
    Aug 11, 2020 at 20:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.