1
General / Setting Up With CMAKE tutorial Help
« on: June 21, 2012, 04:03:15 am »
Hey guys I am stuck on this tutorial. It says
I don't understand how I am supposed to set a path variable.. I installed C-Make and I downloaded the SFML 2.0 files and put them in respective folders. But I don't know what I am doing wrong. Whenever I open the visual studio command prompt and type cmake I get nothing just an unknown command error. Any ideas or help?
Quote
Configuring your SFML build
This step consists of creating the projects/makefiles that will finally compile SFML. Basically it consists of choosing what to build, how to build it and where. Plus a few other options so that you can create the perfect build that suits your needs -- we'll see that in detail later.
The first thing to choose is where the projects/makefiles and object files (files resulting from the compilation process) will be created. You can generate them directly in the source tree (ie. the SFML root directory), but it will then be polluted with a lot of garbage: a complete hierarchy of build files, object files, etc. The cleanest solution is to generate them in a completely separate folder so that you can keep your SFML directory clean. Using separate folders will also make it easier to have multiple different builds (static, dynamic, debug, release, ...).
Now that you've chosen the build directory, there's one more thing to do before you can run CMake. When CMake configures your project, it tests the availability of the compiler (and checks its version as well). As a consequence, the compiler executable must be available when CMake is run. This is not a problem for Linux and Mac OS X users, since the compilers are installed in a standard path and are always globally available, but on Windows you may have to add the directory of your compiler in the PATH environment variable, so that CMake can find it automatically. This is especially important when you have several compilers installed, or multiple versions of the same compiler.
On Windows, if you want to use gcc (MinGW), you can temporarily add the MinGW\bin directory to the PATH and then run cmake from the command shell:
> set PATH=%PATH%;your_mingw_folder\bin
> cmake
With Visual C++, you can either run CMake from the "Visual Studio command prompt" available from the start menu, or call the vcvars32.bat file of your Visual Studio installation; it will setup the environment variables properly.
> your_visual_studio_folder\VC\bin\vcvars32.bat
> cmake
Now you are ready to run CMake. In fact there are three different ways to run it:
cmake-gui
This is a graphical interface that allows you to configure everything with buttons and text fields; this is probably the easiest solution for beginners and people who don't want to deal with the command line; it's also very convenient to see and edit the build options.
cmake -i
This is the command line interactive invocation, you will be prompted to fill every build option explicitely; this is a good option to start with the command line, since you probably don't remember all the options that are available, and don't know which ones are relevant.
cmake
This is the direct invocation, you must put all the options and their values directly.
In this tutorial I will focus on cmake-gui, as this is most likely what beginners will use. I assume that people who use the command line can learn the syntax from the CMake manual. Except the screenshots and the "click there" stuff, all the explanations below still applies (options are the same).
Here is what cmake-gui looks like:
I don't understand how I am supposed to set a path variable.. I installed C-Make and I downloaded the SFML 2.0 files and put them in respective folders. But I don't know what I am doing wrong. Whenever I open the visual studio command prompt and type cmake I get nothing just an unknown command error. Any ideas or help?