|
Boost : |
Subject: Re: [boost] [CMake] what to do now?
From: Paul Fultz II (pfultz2_at_[hidden])
Date: 2016-04-15 16:09:44
On Friday, April 15, 2016 at 1:11:03 PM UTC-5, 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.
>
Yes and CMake doesn't traverse up the directory looking for a root cmake
file.
>
> And a CMake-based Boost should probably also put its build directories
> outside the library root by default.
>
And this is entirely decided how the user decides to invoke cmake, as cmake
will always configure build artefacts in the current directory. So if the
user
in the root directory, the user could do this:
cmake test/
cmake --build test --target check
This will build in the root directory, and there is nothing in cmake to
prevent this ultimately. Fortunately, this is considered bad practice and no
one ever builds libraries with cmake this way unless your name happens to be
Robert Ramey.
>
>
> _______________________________________________
> Unsubscribe & other changes:
> http://lists.boost.org/mailman/listinfo.cgi/boost
>
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk