make it work in C++
add CMake file