Find the linking flags of a target

Is there a way to extract the linking flags required to link to a cmake target? I’m working with a different build system and need to link to a library which use cmake.

This script might provide some inspiration. But it’s not something one can statically determine without actually running CMake.