Search code examples
c++macosboostdarwin

passing compiler flags to boost libraries (such as Thread) which require compilation


So I know that the boost libraries are primarily header-only but there are a few which require compilation, for example Boost.Thread. In Darwin, how do I compile these and pass the -m32 flag so they can be compiled into a 32-bit (i386) binary? There's this Jamroot thing which I've never heard of and I am not sure at all where to start.

Clarification: I'm not asking how to compile a program with -m32 flag and use the boost libraries. I'm asking how to compile the Boost libraries themselves with the -m32 flag.


Solution

  • To specify what architecture to compile for, specify the architecture feature when invoking b2.

    To specify compiler options that don't already have built-in features, specify the cxxflags feature when invoking b2.

    To specify linker options that don't already have built-in features, specify the linkflags feature when invoking b2.

    All of these are listed in the Boost.Build docs.