Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Setting Up With CMAKE tutorial Help  (Read 4787 times)

0 Members and 1 Guest are viewing this topic.

curscascis

  • Newbie
  • *
  • Posts: 6
    • View Profile
Setting Up With CMAKE tutorial Help
« on: June 21, 2012, 04:03:15 am »
Hey guys I am stuck on this tutorial. It says
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?

Spirro

  • Jr. Member
  • **
  • Posts: 66
    • View Profile
Re: Setting Up With CMAKE tutorial Help
« Reply #1 on: June 21, 2012, 04:36:40 am »
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?

Under Windows 7 click start, right click computer then select properties.  At the upper left of the window that appears you will see an option called "Advanced System Settings".  Click that and a new window comes up.  At the lower right click "Environment Variables".  Yet another window comes up with a scrollable window at the bottom.  Scroll till you find "Path".  Select "Path" then click edit.  A text entry box comes up.  Now, at the end of the list, enter the path to your installed version of CMake, preceded by a semi colon.  Click Ok then try the tutorial again and everything should work fine.
« Last Edit: June 21, 2012, 04:40:41 am by Spirro »

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Setting Up With CMAKE tutorial Help
« Reply #2 on: June 21, 2012, 07:22:18 am »
Quote
Under Windows 7 click start, right click computer then select properties.  At the upper left of the window that appears you will see an option called "Advanced System Settings".  Click that and a new window comes up.  At the lower right click "Environment Variables".
Don't do that! I will add the variable permanently.

The tutorial shows how to do:
> set PATH=%PATH%;your_mingw_folder\bin
(to type in the console)
Laurent Gomila - SFML developer

Spirro

  • Jr. Member
  • **
  • Posts: 66
    • View Profile
Re: Setting Up With CMAKE tutorial Help
« Reply #3 on: June 21, 2012, 08:40:27 am »
Quote
Under Windows 7 click start, right click computer then select properties.  At the upper left of the window that appears you will see an option called "Advanced System Settings".  Click that and a new window comes up.  At the lower right click "Environment Variables".
Don't do that! I will add the variable permanently.

The tutorial shows how to do:
> set PATH=%PATH%;your_mingw_folder\bin
(to type in the console)

I don't know about earlier versions of CMake, but 2.8 actually does set the PATH to itself without notification on installation.


Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Setting Up With CMAKE tutorial Help
« Reply #4 on: June 21, 2012, 08:50:10 am »
Quote
I don't know about earlier versions of CMake, but 2.8 actually does set the PATH to itself without notification on installation.
It's the path to the compiler that we need to set, not the path to CMake.
Laurent Gomila - SFML developer

Celtic Minstrel

  • Jr. Member
  • **
  • Posts: 80
    • View Profile
Re: Setting Up With CMAKE tutorial Help
« Reply #5 on: June 21, 2012, 09:21:06 am »
Quote
Under Windows 7 click start, right click computer then select properties.  At the upper left of the window that appears you will see an option called "Advanced System Settings".  Click that and a new window comes up.  At the lower right click "Environment Variables".
Don't do that! I will add the variable permanently.
What's wrong with adding it permanently to the path?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Setting Up With CMAKE tutorial Help
« Reply #6 on: June 21, 2012, 09:30:02 am »
Quote
What's wrong with adding it permanently to the path?
It's not recommended, as it can easily produce a big mess if you start using several compilers, or different versions of the same compiler.

But yes, it would work too.
Laurent Gomila - SFML developer