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

Author Topic: FindSFML cannot find SFML  (Read 6047 times)

0 Members and 1 Guest are viewing this topic.

robvleugel

  • Newbie
  • *
  • Posts: 29
    • View Profile
FindSFML cannot find SFML
« on: December 07, 2013, 02:31:58 pm »
Hello all,

I always used SFML with Visual studio without problems, but now recently I want to change from a VS environment to Cmake so I can develop both on my windows PC and my linux laptop.

The problem arises when using the find_package(SFML 2 REQUIRED system window graphics network audio)
I've added the FindSFML.cmake file, but I get the following error when trying to run cmake:

"Cmake Error at cmake_modules/FindSFML.cmake:307 (message):
   Could NOT find SFML (missing: SFML_SYSTEM_LIBRARY SFML_WINDOW_LIBRARY etc. etc.

I installed SFML in C:\Project Files (x86)\, I've set a system variable SFML_ROOT to "C:\Project Files (x86)\SFML". I'm clueless to why it cannot find this directory. This directory contains the complete content of the SFML-2.1-windows-vc11-64bits.zip file that I just downloaded, did I have to do more to install SFML?
(E.g. System.hpp is located in "C:\Program Files (x86)\SFML\include\SFML")

Kind regards,
Rob

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: FindSFML cannot find SFML
« Reply #1 on: December 07, 2013, 02:43:33 pm »
Quote
I've set a system variable SFML_ROOT to "C:\Project Files (x86)\SFML"
You mean an environment variable? It should work, but you can try to define it as a CMake variable instead.

Quote
E.g. System.hpp is located in "C:\Program Files (x86)\SFML\include\SFML
And "C:\Program Files (x86)\SFML\lib" contains all the SFML libraries, right?
Laurent Gomila - SFML developer

robvleugel

  • Newbie
  • *
  • Posts: 29
    • View Profile
Re: FindSFML cannot find SFML
« Reply #2 on: December 07, 2013, 03:30:50 pm »
Quote
I've set a system variable SFML_ROOT to "C:\Project Files (x86)\SFML"
You mean an environment variable? It should work, but you can try to define it as a CMake variable instead.

Quote
E.g. System.hpp is located in "C:\Program Files (x86)\SFML\include\SFML
And "C:\Program Files (x86)\SFML\lib" contains all the SFML libraries, right?

Yes obviously, its just the whole content of the zip file so the SFML\lib contains all the .lib files that came with the package.
I checked out echo %SFML_ROOT% in the command and the environment var was set correct. Ill try the cmake var when I get home but I do not understand why its not working now, setting SFML_ROOT in cmake should not make any difference in theory.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: FindSFML cannot find SFML
« Reply #3 on: December 07, 2013, 04:16:45 pm »
I don't understand either, so we'll have to check obvious things to spot the error.
Laurent Gomila - SFML developer

robvleugel

  • Newbie
  • *
  • Posts: 29
    • View Profile
Re: FindSFML cannot find SFML
« Reply #4 on: December 07, 2013, 10:16:22 pm »
This is the code I use in my CMakeLists file:

Code: [Select]
# Detect and add SFML
find_package(SFML 2 REQUIRED system window graphics network audio)
if(SFML_FOUND)
  include_directories(${SFML_INCLUDE_DIR})
  target_link_libraries(${EXECUTABLE_NAME} ${SFML_LIBRARIES})
endif()

And the FindSFML.cmake is this one:
https://github.com/SFML/SFML/blob/master/cmake/Modules/FindSFML.cmake (unmodified)


I added set(SFML_ROOT "C:\\Project Files (x86)\\SFML") just before the find_package call and this did not help either.



Edit:

Apparently its not Project Files (x86) but Program Files (x86)  ::)
It works now, thanks for your time and sorry for bothering you with this
« Last Edit: December 07, 2013, 10:49:42 pm by robvleugel »