fix gh-1540 and close gh-1541. Don't use rpath if the user didn't provid...

...ed cuda.root.