I use cmake to build, test and install my project. My way is a little crude: I use a scripts like this to get an out-of-source build:
DIR=debug_build &&
rm -fr ./${DIR} &&
mkdir -p ${DIR} &&
cd ${DIR} &&
cmake -D CMAKE_BUILD_TYPE=Debug $@ .. &&
make
I guess I could at least put it into makefile, but isnt it strange to use Makefile to run cmake to generate new Makefiles and run another make?
What is the proper way to do it? Does cmake have an option to avoid calling "cd"?
Recently it became even more complicated as I factoread out a library that I would like to compile, test and distribute separately. I want to avoid duplication of all the stuff I have in my top CMakeLists.txt.
How to do it properly with cmake?