modified CMakeLists.txt and fixed bug in passing pointer