Improve test if library is a CMake target

Newer CMake complains when you try to get the property of something
that isn't a target so use the specific if operator instead.
1 file changed