moved to cmake + improved portability