Added CMakeLists.txt and fixed build issue on gcc

CMakeLists.txt to accomodate for other platforms, verified that this change will work on Linux with gcc.