Setting up a project


#1

I am trying to follow the instructions here using the Link with binaries option and a little confused on where to put the CMakeLists.txt file. It says to create it in my project folder which I assume is the root folder of my project. Further down I follow the build instructions:

  • mkdir build
  • cd build
  • cmake -G …

If I do this I get an error that the CMakeLists file can’t be found ( because it’s in my root folder ). If I go up a directory and run cmake, it is successful but everything shows up in my root folder and not the build folder. Is CMakeLists supposed to go in the build folder?

I am using VS2017 in Windows.


#2

The CMakeLists should be in your project directory, not the build directory.

You can set it up like this:

project
    build
    CMakeLists.txt
    main.cpp

In your terminal windows, go to build dir then run this command
cmake -G "Visual Studio 15 2017 Win64" ..


#3

The two dots .. in cmake .. tell it to look for CMakeLists.txt in one folder up than the current one. So if you are currently in your build folder, which is part of your root folder, it will look in the root folder for CMakeLists.txt. I’d double-check if you’re typing everything in correctly, and if not report back (perhaps with an exact list of commands used + folder structure).


#4

yup, missed the 2 dots thanks!