I am wondering if there is a CMake command line interface option, which does the same as --directory
(-C
) for GNU make?
What I want to do is to tell CMake to generate the build files in the source directory, not in CWD.
The quick and dirty way of doing this could be:
cd path/to/source && cmake . && make && make install
however, there must be a better way.
I was considering
cmake --build "path/to/source"
but that requires the build files to be present, and
cmake . -E chdir "path/to/source"
dumps the build files in CWD, just like:
cmake /path/to/source