Let's say I have a project where I've already run CMake in .build directory:
project/
.build/
.src
Presently I must do this to run the build:
cd .build
make
I'd like to be able to run make from the root of my project, perhaps with
make -f ./build/Makefile
but it doesn't work. I get errors like this
make[1]: CMakeFiles/Makefile2: No such file or directory
make[1]: *** No rule to make target `CMakeFiles/Makefile2'. Stop.
make: *** [all] Error 2
This is because the CMake-generated Makefile assumes its working directory is the same as where it resides (.build).
Is it possible to have CMake generate a makefile such that the makefile changes the working directory to where it resides?