support for out of directory building by setting kernel dir in CMakeLists.txt