fix recent cmake warnings and update cmake way of handling rpath