Work around cmake bug where it segfaults during link phase