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