cmake improvements

Signed-off-by: Silvio Traversaro <silvio.traversaro@iit.it>