Handle building the dynamic library in a better way