.
|-bin
| |-Debug
|-source
|-sh
| |-runme.sh
|-CMakeLists.txt
Normally, I cd bin/Debug. Then cmake -DCMAKE_BUILD_TYPE=Debug ../../ following cmake --build .
Now, I want to create a bash script sh/runme.sh that I can call from main . directory using sh sh/runme.sh Debug, which is intended to do the same work as described in the previous line.
My present runme.sh:
cd bin/"$1"  # of course this does not work.
cmake -DCMAKE_BUILD_TYPE=Debug ../../
cmake --build .
If I run cmake -DCMAKE_BUILD_TYPE=Debug . following cmake --build . from main . directory, it creates CMakeFiles/, cache, makefile etc. relative to main . directory and not in the respective bin/Debug directory.
What and where (CMakeLists.txt or sh/runme.sh) should I change to make this work? Preferably to CMakeLists.txt. I want to keep main directory clean.
 
    