use cmake variable to set linker flags

Putting static linking in C(XX) flags is total overkill, and CMake
provides a nice variable for these kinds of linker flags.