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