cmake/OpenCVGenPkgconfig.cmake: rework opencv.pc generation

Hi all,

Here is a patch refactoring the opencv.pc file generation.
This fixes link-time failure of project linking with opencv.

Thought this PR is done for the 2.4 branch, this patch can be properly cherry-picked with no conflict on top of master.

Futher details about the changes in the commit message.

Regards,

Samuel
While this doesn't impact correctness... why the underscore in `_libpath` and `_libname`? There's none in the other branch, or in the original code.