You should use a generator expression for this.
From the docs for add_custom_command and the docs for generator expressions:
Arguments to
COMMANDmay use “generator expressions”…Generator expressions are evaluted during build system generation to produce information specific to each build configuration.
In this case, assuming your library target is called “MyLib”, the generator expression representing the full path to the built library would be:
$<TARGET_FILE:MyLib>