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

Author Topic: Cmake can't find SFML?  (Read 4403 times)

0 Members and 1 Guest are viewing this topic.

marek3571

  • Newbie
  • *
  • Posts: 5
    • View Profile
Cmake can't find SFML?
« on: August 11, 2011, 12:56:35 am »
Hi,
I'm trying to get one of the SFML 2.0 builds to work with my own project using cmake. CMake says it found SFML, but the include directory is set to not found. I'm using visual studio 2010.

Here's the code I'm using in cmake:
Code: [Select]

find_package (SFML REQUIRED)
if (SFML_FOUND)
include_directories(${SFML_INCLUDE_DIR})
target_link_libraries(OMG_Engine ${SFML_LIBRARIES})
endif (SFML_FOUND)


Here's the cmake output:
Code: [Select]

Found SFML: SFML_INCLUDE_DIR-NOTFOUND
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
SFML_INCLUDE_DIR
   used as include directory in directory C:/Users/Marek/Documents/sfmlTest


How do I fix this?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Cmake can't find SFML?
« Reply #1 on: August 11, 2011, 07:59:19 am »
Hmm I'll check the code and see why "Found SFML" is printed in this case.

Anyway, your problem is that SFML is not found. Make sure that it's installed in a path that the compiler knows, or that the SFMLDIR CMake variable is correctly defined.
Laurent Gomila - SFML developer

marek3571

  • Newbie
  • *
  • Posts: 5
    • View Profile
Cmake can't find SFML?
« Reply #2 on: August 13, 2011, 05:03:20 am »
Well I found that SFMLDIR wasn't set. I thought it was supposed to have been set when I installed, but I'm pretty new to cmake so i was probably wrong. I set SFMLDIR to the correct directory, but I noticed that the libraries weren't linking, and
Code: [Select]
message ("${SFML_LIBRARIES}") printed an empty line.

marek3571

  • Newbie
  • *
  • Posts: 5
    • View Profile
Cmake can't find SFML?
« Reply #3 on: August 15, 2011, 12:46:16 am »
Actually I just forgot the COMPONENTS part of the find_package command. My bad. Everything appears to be working fine now, but it still wouldn't explain why it said that SFML was found when it couldn't find the include directory.