Add -ldl to cmake required flags as well.