Boost logo

Boost-Build :

From: Paul Bristow (paul.a.bristow_at_[hidden])
Date: 2021-02-25 18:02:13

> -----Original Message-----
> From: Boost-build <boost-build-bounces_at_[hidden]> On Behalf Of Robert Ramey via Boost-build
> Sent: 24 February 2021 19:49
> To: boost-build_at_[hidden]
> Cc: Robert Ramey <ramey_at_[hidden]>; boost_at_[hidden]
> Subject: Re: [Boost-build] Getting stated with boost and CMake
> On 2/24/21 7:46 AM, Paul A Bristow via Boost-build wrote:
> > Having spent a decade watching the Cmake versus bjam/b2 battle, I had thought it wise to wait until
> the dust has settled.
> >
> > It would appear that the enthusiasm for CMake and Boost is much
> > greater among consumers than producers ☹
> >
> > But recently I have been working on a project that is possible Boost library and thought that I would
> dip my toe in the water.
> >
> > After some research, I am still puzzled how I should replace a simple
> > b2/bjam program (say a classic “hello World”) that is run like this
> >
> > \example > b2 -a toolset=msvc,gcc,clang cxxstd=14 release >
> > my_log.log
> >
> > The jamfile contains
> >
> > run hello_world.cpp ; # Simplest hello_world, no other includes apart from iostream.
> >
> > And the b2 run .log contains some outputs of "Hello world" and 3 nice **passed** lines and
> ...updated 3(?) targets..., one for each compiler (and version too, perhaps with some potentially using
> build info too), and return exit_success value.
> >
> > (I also would expect to get a simple setup to run a test using the /included version of
> unit_test_framework.
> > Trying to walk before I fall over running, I have avoided any
> > pre-compiler libraries, at least at first.)
> >
> > After some research (getting as far as generating a Visual Studio
> > project, where I can intervene manually to build and run my hello_world program), I am still unclear
> how to replicate this b2 test to end with a .exe run and some log file with pass/fail indications.
> >
> > I am of course building on Windows 10 with three recent versions of MSVC, GCC and Clang compilers
> working, and in my bjam/b2 user-config.jam.
> >
> > Advice from less-than-novice CMakers most welcome.
> You might check out the serialization and/or the safe numerics library.
> They are a little different projects. One is header only while the other isn't. The serialization library
> CMake is a little older and structures the CMake.txt files a little differently. But in both cases they are
> designed to run all the tests.
> serialization:
> It has a very elaborate bjam file in the test directory. It builds all the required boost componenents, the
> serialization library itself and runs all the tests. The "equivalent" (as far as I can make it) CMake ...
> I use to build the IDE. From the IDE (xcode in my case) I pick targets (e.g. BUILD_ALL, RUN, ... or some
> specific target (test) name) and invoke the IDE. Works pretty well.

I have yet to find the output from ALL_BUILD in VS.

I normally use a custom build event to run each project, as recommended by Gennadiy using Boost.Test.

"$(TargetDir)$(TargetName).exe" --build_info=yes

(and I add a custom Property page to each project using the property window).

But that doesn't happen of course.

So how do I get them all to run?

> Once I've got things debugged, I re- run the same thing with b2 to make sure everyone is in agreement.
> Then I check-in.
> My motivation for spending time with CMake was to be able to use an IDE without constantly syncing it
> with the bjam settings. This is a problem I had using the IDE with windows. All in all I'm pleased with
> the whole mess.
> safe numerics
> header only library with both compile and execute tests. A more modern CMake.txt layout.

I've worked from this and this builds a plausible VS solution that builds OK. (But I have yet to get run to produce output).

I also don't see how CMake is any help if you don't have an IDE for the compiler.


(Actually I can use GCC and Clang with Codeblocks, but to *have to* and to run it seems not to do what b2 does at all).

Thanks - but still puzzled.


> FYI - I consider myself a novice CMake user. But then I also consider myself a novice B2 user.
> So, truth be told, I actually like CMake and B2 - I see them as useful in different ways.
> Of course they both make one pull his hair out in different ways also.

Ah so that may explain some aspects of my appearance 😉

Boost-Build list run by bdawes at, david.abrahams at, gregod at, cpdaniel at, john at