if a target-dependent generator expression is used in add_custom_command, say that's the problem, and not that the target doesn't exist.
E.g.
CMake Error at cmake/modules/common.cmake:826 (add_custom_command):
Error evaluating generator expression:
$<TARGET_FILE_NAME:pcap_wpcap>
No target "pcap_wpcap"
is not a useful error message when the problem is that a custom command of the form:
add_custom_command(OUTPUT "${CMAKE_BINARY_DIR}/artifacts/$<CONFIG>/$<TARGET_FILE_NAME:${TARGETNAME}>")
was used.
The error message should instead be
Error evaluating generator expression: add_custom_command does not support target-dependent generator expressions in the OUTPUT parameter