cpp and cmakelists for statemachine