build rpath does not prevent picking up installed library when using PKG_CHECK_MODULES
On Linux, cmake very nicely switches between build time rpath and installed rpath. And it has PKG_CHECK_MODULES which lets you use libraries installed with .pc files. So far so good.
But if one of the libraries you use via PKG_CHECK_MODULES specifies an rpath, and the library you're developing gets installed to the same place as one of those libraries, you can end up with mysterious crashes.
Changing cmLocalGenerator::OutputLinkLibraries() to add the build rpath entries before the ones from CFLAGS resolves the problem.