Split the c++ source files into separate source sets for shared, lib and curses