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. And a CMake-based Boost should probably also put its build directories outside the library root by default.