You could follow this tutorial 1, which explains how to write the CMakeLists.txt, setup the general project, and build it, as it seems you are trying to use a manual setup, which is missing some includes.