SFML community forums

Bindings - other languages => C => Topic started by: c-jay on August 09, 2016, 09:49:31 pm

Title: CMAKE failure
Post by: c-jay on August 09, 2016, 09:49:31 pm
Hi,

i'd like to generate build files with cmake. It generates this failure:

CMake Error at src/SFML/CMakeLists.txt:28 (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) 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.

I don't understand the reported solutions:
1) Where is the CMAKE_MODULE_PATH to put the "FindSFML.cmake" into?
2) How could i add the installation prefix of "SFML" to CMAKE_PREFIX_PATH?
3) Where are the directory of the files SFMLConfig.cmake and sfml-config.cmake?

I am very thankful for every solution.
Title: AW: CMAKE failure
Post by: eXpl0it3r on August 09, 2016, 09:55:00 pm
The problem is that CMake can't find the FindSFML.cmake. CMake searches the directory set by CMAKE_MODULE_PREFIX, which by default is empty. For your CMake script you can set it to the directory where the FindSFML.cmake is located or you can let the user define it when using SFML.
Title: Re: CMAKE failure
Post by: c-jay on August 09, 2016, 10:00:14 pm
thank you for your reply.
I'm the user ;-)
1)How could i figure out which directory is set by CMAKE_MODULE_PREFIX ?
2)How could i set it to the right directory?
Title: AW: CMAKE failure
Post by: eXpl0it3r on August 09, 2016, 10:21:28 pm
Sorry, I made a mistake it's of course CMAKE_MODULE_PATH not prefix.
You can.just use the set function in your CMake script.
Title: Re: CMAKE failure
Post by: c-jay on August 10, 2016, 06:24:13 pm
Thank you.

I don't know very much about cmake files. Do you have a snipped of code which i have to paste in the skript?
Title: Re: CMAKE failure
Post by: c-jay on August 10, 2016, 06:48:21 pm
I found the solution.

1) Copy FindSFML.cmake from SFML-Master/cmake/ to CSFML-Master/
2) add
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/" ${CMAKE_MODULE_PATH})
to CSFML-Master/src/SFML/CMakeLists.txt

My next question: Why isn't this write down in the csfml-documentation for ubuntu-beginner like me?

Title: Re: CMAKE failure
Post by: Laurent on August 10, 2016, 07:26:04 pm
Quote
Why isn't this write down in the csfml-documentation for ubuntu-beginner like me?
I agree, but the thing is that there's no tutorial for CSFML. The only available documentation is the API doc auto-generated from source code.