Revised CMakeLists.txt (take 2) with changes suggested by Pavel Koshevoy

- Also works on MacOSX