Added new library build macro
changed cmakelists to use new library macro