SFML community forums

Bindings - other languages => C => Topic started by: netrick on July 20, 2013, 06:38:22 pm

Title: Cmake doesn't work on Linux
Post by: netrick on July 20, 2013, 06:38:22 pm
(I have SFML 2 installed of course.)

When I try to run "cmake ." on CSFML sources I get:

Code: [Select]
CMake Error at src/SFML/CMakeLists.txt:27 (find_package):
  By not providing "FindSFML.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "SFML", but
  CMake did not find one.

  Could not find a package configuration file provided by "SFML" (requested
  version 2.0) with any of the following names:

    SFMLConfig.cmake
    sfml-config.cmake

  Add the installation prefix of "SFML" to CMAKE_PREFIX_PATH or set
  "SFML_DIR" to a directory containing one of the above files.  If "SFML"
  provides a separate development package or SDK, be sure it has been
  installed.


-- Configuring incomplete, errors occurred!

How can I fix it? I know nothing about configuring Cmake. Also as SFML is installed, why it didn't install the Cmake configuration file?
Title: Re: Cmake doesn't work on Linux
Post by: eXpl0it3r on July 20, 2013, 08:34:00 pm
Well CMake is telling you, that it couldn't find FindSFML.cmake. This gets shipped with SFML. You can now either specify CMAKE_MODULE_PATH to the directory where that file is, or you could copy the file to the location where all the other FindXXX.cmake files are (not sure where that is on Linux).
Title: Re: Cmake doesn't work on Linux
Post by: netrick on July 20, 2013, 09:33:53 pm
Okay I found the solution. I copied FindSFML.cmake to /usr/share/Cmake/modules. However, why "make install" of SFML doesn't do it? Laurent, could you explain it?
Title: Re: Cmake doesn't work on Linux
Post by: eXpl0it3r on July 20, 2013, 10:00:11 pm
Have you run it with sudo make isntall? Because iirc make doesn't access to the share directory by default, but I might be wrong. I thought SFML installs it, but to be sure I'd have to look at the CMake file again.
In any case, feel free to add it and make a pull request, SFML is Open Source you know. ;)
Title: Re: Cmake doesn't work on Linux
Post by: Laurent on July 20, 2013, 10:56:33 pm
/usr/share/Cmake/modules might not be accessible on everyone's computer (think about students with access rights only in their home folder), so I can't copy FindSFML.cmake there by default.
Title: Re: Cmake doesn't work on Linux
Post by: netrick on July 21, 2013, 09:43:03 am
/usr/share/Cmake/modules might not be accessible on everyone's computer (think about students with access rights only in their home folder), so I can't copy FindSFML.cmake there by default.

But, the whole "sudo make install" copies files to /usr/local so make install itself requires root access. Make install should copy cmake files as it's basically everything or nothing deal. (without root access, the libs and headers wont be copied as well).
Title: Re: Cmake doesn't work on Linux
Post by: Laurent on July 21, 2013, 11:23:27 am
Quote
But, the whole "sudo make install" copies files to /usr/local
The install directory can be changed. /usr/local is just the default.