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
The logic seems correct, but the name `maybe_l_prefix` no longer fits the variable, since it can now contain more than just `-l`. Please rename it to something else.