Add cmake code to create library for c++

Moreover, add missing include in ```src/stack-template.t.cpp```