Fix some linkage issues with the cmake build system.