buick
is a snippet to automate running cmake
in a user-defined build directory to prevent the notorious cmake build cache files contamination.
Download and chmod
the script buick
. To make it system-wide available, just create an alias in your shell rc file.
buick
with no arguments willcd
to the build directory andmake
.buick <path_to_CMakeLists> <cmake_commandline_arguments>
will create./build
and runcmake <cmake_commandline_arguments>
in it.<path_to_CMakeLists>
can be relative.- The above command will create
./.buick
in which the build directory and last successful cmake command are cached. buick --last-cmake
runs the cached cmake command.buick --build-dir=<your_build_dir>
uses a different directory than the default./build
.buick --clean
willrm -rf
the cached build directory if it exists. Passing--clean
will makebuick
ignore all other arguments.
- I only included gnu make. For other build tools, please modify the script as needed.
- Relative paths used in cmake commandline options may not be properly supported.