fix compilation when check is not available

a commit introduced a target-link-libraries on a library which is not available when compiling without test