add BUILD_AS_LIBRARY cmake flag