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

Author Topic: Cmake doesn't work on Linux  (Read 9739 times)

0 Members and 2 Guests are viewing this topic.

netrick

  • Full Member
  • ***
  • Posts: 174
    • View Profile
Cmake doesn't work on Linux
« 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?

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: Cmake doesn't work on Linux
« Reply #1 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).
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

netrick

  • Full Member
  • ***
  • Posts: 174
    • View Profile
Re: Cmake doesn't work on Linux
« Reply #2 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?

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: Cmake doesn't work on Linux
« Reply #3 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. ;)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Cmake doesn't work on Linux
« Reply #4 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.
Laurent Gomila - SFML developer

netrick

  • Full Member
  • ***
  • Posts: 174
    • View Profile
Re: Cmake doesn't work on Linux
« Reply #5 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).

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Cmake doesn't work on Linux
« Reply #6 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.
Laurent Gomila - SFML developer