If you are using the built-in CMake support in Visual Studio, you need to do “Open Folder” on the root folder of your project, not the src
folder.
Personally, I find this experience inferior to generating project files and opening the generated project. If you want to do that, then:
mkdir build
cd build
cmake ../root
…asssuming your project root folder is called “root”. I don’t like having the build directory inside the source directory, so I always locate it as a peer to my source directory. I don’t remember where VS decides to put the build directory when you use the built-in CMake support, probably somewhere inside your top-level source directory.