Refactor some CMake to support Linux.