pulled in patches from debian, linker issue with static builds and trimmed up cmake files