replace source and build directories with palceholders
* move to common CMake function * escape CFLAGS