Improvements in CMake package config generation.

Added an input variable to choose the target libraries to export instead of
all the generated ones.
Fixed extraction of library names from target properties.

The intention of this change is to restrict the libraries exported by FOOConfig.cmake to those that provide the C++ API being exported (for example, python binding libraries can be filtered out).