CMake: fix link dependencies with clang compiler

Suggested by: https://github.com/jlblancoc/mrpt/issues/6