Don't check the LOCATION property.

Reading the LOCATION property is deprecated in newer versions of CMake.
Instead read the TYPE property in order to determine if this was a
target created by add_custom_target.