SFML community forums
General => General discussions => Topic started by: marek3571 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:
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:
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?
-
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.
-
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
message ("${SFML_LIBRARIES}")
printed an empty line.
-
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.