Boost logo

Boost :

Subject: Re: [boost] [CMake] what to do now?
From: Edward Diener (eldiener_at_[hidden])
Date: 2016-04-15 14:30:07


On 4/15/2016 2:10 PM, Peter Dimov wrote:
> Paul Fultz II wrote:
>> Because Cmake creates build artefacts when it runs, its best practice
>> to create a separate build directory to run cmake. This avoids build
>> artefacts from overwriting source files, and it makes it easier to
>> clear out the build directory(necessary sometimes). To support
>> multiple toolchains, I need to configure a build directory for each
>> toolchain:
>>
>> mkdir build-4.6 && cd build-4.6 && CXX=g++-4.6 cmake .. && cd ..
>> mkdir build-4.7 && cd build-4.7 && CXX=g++-4.7 cmake .. && cd ..
>> mkdir build-4.8 && cd build-4.8 && CXX=g++-4.8 cmake .. && cd ..
>> mkdir build-4.9 && cd build-4.9 && CXX=g++-4.9 cmake .. && cd ..
>> mkdir build-clang && cd build-clang && CXX=clang++ cmake .. && cd ..
>>
>> Then if I want to build the tests for each toolchain, I need to build
>> each directory:
>>
>> ls -1 build-* | xargs -n1 cmake --target check --build
>
> Boost.Build's build directory by convention is relative to Jamroot, not
> to the current directory or to the Jamfile, so it doesn't have this
> problem.

Furthermore the '--build-dir' command line option can specify the
overall Boost build directory wherever it wants it. I regularly do Boost
building in Windows completely outside the Boost source tree, since my
source tree is shared by multiple Windows versions on Windows and
multiple Linux distros on Linux.

>
> And a CMake-based Boost should probably also put its build directories
> outside the library root by default.

I agree and the end-user of CMake should be able to change this as he
chooses.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk