SFML community forums
Bindings - other languages => C => Topic started by: shahn on November 18, 2010, 09:31:49 pm
-
Hi!
I just saw, that sfml switched to cmake in the version 2 branch. That's great! I have a problem building CSFML, though: When trying to do the cmake configuration I get:
#:~/src/sfml2/bindings/c/build$ cmake ..
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_AUDIO_LIBRARY_DEBUG
linked by target "csfml-audio" in directory /home/shahn/src/sfml2/bindings/c/src/SFML/Audio
SFML_GRAPHICS_LIBRARY_DEBUG
linked by target "csfml-graphics" in directory /home/shahn/src/sfml2/bindings/c/src/SFML/Graphics
SFML_NETWORK_LIBRARY_DEBUG
linked by target "csfml-network" in directory /home/shahn/src/sfml2/bindings/c/src/SFML/Network
SFML_SYSTEM_LIBRARY_DEBUG
linked by target "csfml-system" in directory /home/shahn/src/sfml2/bindings/c/src/SFML/System
linked by target "csfml-window" in directory /home/shahn/src/sfml2/bindings/c/src/SFML/Window
linked by target "csfml-network" in directory /home/shahn/src/sfml2/bindings/c/src/SFML/Network
linked by target "csfml-graphics" in directory /home/shahn/src/sfml2/bindings/c/src/SFML/Graphics
linked by target "csfml-audio" in directory /home/shahn/src/sfml2/bindings/c/src/SFML/Audio
SFML_WINDOW_LIBRARY_DEBUG
linked by target "csfml-window" in directory /home/shahn/src/sfml2/bindings/c/src/SFML/Window
linked by target "csfml-graphics" in directory /home/shahn/src/sfml2/bindings/c/src/SFML/Graphics
-- Configuring incomplete, errors occurred!
It seems to work, when you installed both the release and the debug version of SFML. If you just want a release build, it fails like described.
Using Ubuntu 10.10, x86_64, branches/sfml2 revision 1671
(btw: is this the right place for questions like this? I didn't find an active bug tracker.)
-
Indeed, the current FindSFML.cmake searches both debug and release versions. I guess I should improve this.
is this the right place for questions like this? I didn't find an active bug tracker
Yep, the forum is the right place for everything. I prefer filtering things and updating the task tracker myself.
-
It might be a preliminary solution to just install both the debug and the release versions of SFML by default.
-
You can't have both versions in one build.
But anyway, the solution is to fix FindSFML.cmake ;)
-
I ran into a similar problem, this time on windows XP using minGW and msys:
$ cmake -G "MSYS Makefiles" ..
[snip]
CMake Error at c:/Program Files/CMake 2.8/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:91 (MESSAGE):
Could NOT find SFML (missing: SFML_SYSTEM_LIBRARY SFML_WINDOW_LIBRARY
SFML_NETWORK_LIBRARY SFML_GRAPHICS_LIBRARY SFML_AUDIO_LIBRARY) (Required is
at least version "2")
Call Stack (most recent call first):
c:/Program Files/CMake 2.8/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:252 (_FPHSA_FAILURE_MESSAGE)
c:/Program Files/CMake 2.8/share/cmake-2.8/Modules/FindSFML.cmake:67 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
src/SFML/CMakeLists.txt:22 (find_package)
, although both the "Debug" and the "Release" versions are installed. Installing SFML reported, that things where installed in C:/Program Files/SFML/
, but cmake doesn't seem to be able to find it there.
I tried to fix this, but without any success. Which is probably cause my knowledge of cmake is not very profound.
Can I fix this easily?
-
but cmake doesn't seem to be able to find it there
How is it supposed to know that? It's not a standard path, and there's nothing written in the registry or in a config file ;)
You need to add a variable in CMake, named SFMLDIR and equal to the path ("C:/Program Files/SFML/").
-
How is it supposed to know that? It's not a standard path, and there's nothing written in the registry or in a config file Wink
I didn't tell cmake to use that path, so it seems to be the standard path in my setup. I am using msys, which caused some strange behaviour with paths before. (But cmake can generate Makefiles specifically for msys, so ideally this should just work.) What would be a standard path?
You need to add a variable in CMake, named SFMLDIR and equal to the path ("C:/Program Files/SFML/").
I added set(SFMLDIR "C:/Program Files/SFML/")
to bindings/c/CMakeLists.txt
. Is this what you meant? The result stays the same though. I also toyed around and tried
passing -DSFMLDIR="C:/Program Files/SFML/" to cmake;
trying the above solutions while escaping the space in the path;
installing in a unix-like path under msys without spaces (with -DCMAKE_INSTALL_PREFIX=/usr/local);
all without success. I am a bit out of ideas, what else to try. Any advice?
-
passing -DSFMLDIR="C:/Program Files/SFML/" to cmake;
This is the right thing to do (never modify the source CMakeLists.txt!).
If you have /include and lib/ under this path, then FindSFML.cmake will be able to find SFML headers and libraries, and CSFML will be configured successfully. On Windows, you'll need to have both debug and release SFML libraries under /lib (I will fix this soon).
If it still doesn't work, show me the new error messages.
-
(never modify the source CMakeLists.txt!).
Yes, that makes sense.
If you have /include and lib/ under this path, then FindSFML.cmake will be able to find SFML headers and libraries, and CSFML will be configured successfully.
Sadly, no. I have the include- and the lib-dir in that directory, both the Release and the Debug version. cmake still fails with the following error:
CMake Error at c:/Program Files/CMake 2.8/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:91 (MESSAGE):
Could NOT find SFML (missing: SFML_SYSTEM_LIBRARY SFML_WINDOW_LIBRARY
SFML_NETWORK_LIBRARY SFML_GRAPHICS_LIBRARY SFML_AUDIO_LIBRARY) (Required is
at least version "2")
Call Stack (most recent call first):
c:/Program Files/CMake 2.8/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:252 (_FPHSA_FAILURE_MESSAGE)
c:/Program Files/CMake 2.8/share/cmake-2.8/Modules/FindSFML.cmake:67 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
src/SFML/CMakeLists.txt:22 (find_package)
(which is the same message as in my post from friday, as far as I see.)
I noticed one interesting thing: If I don't tell cmake to set SFMLDIR to the appropriate path I get this error message:
CMake Error at c:/Program Files/CMake 2.8/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:91 (MESSAGE):
Could NOT find SFML (missing: SFML_INCLUDE_DIR SFML_SYSTEM_LIBRARY
SFML_WINDOW_LIBRARY SFML_NETWORK_LIBRARY SFML_GRAPHICS_LIBRARY
SFML_AUDIO_LIBRARY) (Required is at least version "2")
Call Stack (most recent call first):
c:/Program Files/CMake 2.8/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:252 (_FPHSA_FAILURE_MESSAGE)
c:/Program Files/CMake 2.8/share/cmake-2.8/Modules/FindSFML.cmake:67 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
src/SFML/CMakeLists.txt:22 (find_package)
, which, as you can see, differs in that cmake cannot even find SFML's include dir. This leads me to the conclusion, that cmake uses SFMLDIR to search for the include dir, but ignores it when looking for the lib-dir, for some reason. Or am I wrong?
btw: I really appreciate your help and hope, we can resolve this issue.
-
What does your lib folder contain?
-
$ ls "C:/Program Files/SFML/lib"
libsfml-audio-d.a libsfml-graphics-d.a libsfml-network-d.a libsfml-system-d.a libsfml-window-d.a
libsfml-audio.a libsfml-graphics.a libsfml-network.a libsfml-system.a libsfml-window.a
-
I have no idea, sorry. I can't test with MSYS, but with VC++ it works for me.
Maybe you can try to debug the CMake files yourself, try to figure out what happens.
-
I'll do that, if I find the time. Thanks for your help.
-
Same problem here. Building sfml went fine with VS2010 x86 + x64 versions.
But csfml is reluctant. Even after specifying the sfml install path where bin include and lib is.
CMake Error at F:/cmake-2.8.2-win32-x86/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:70 (MESSAGE):
Could NOT find SFML (missing: SFML_INCLUDE_DIR SFML_SYSTEM_LIBRARY
SFML_WINDOW_LIBRARY SFML_NETWORK_LIBRARY SFML_GRAPHICS_LIBRARY
SFML_AUDIO_LIBRARY)
Call Stack (most recent call first):
F:/cmake-2.8.2-win32-x86/share/cmake-2.8/Modules/FindSFML.cmake:67 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
src/SFML/CMakeLists.txt:22 (find_package)
EDIT: Had to manually specify all of the paths to make it work :(
Remember that you must use '/' separators instead of '\' or you might get some error like me:
CMake Error at cmake/Macros.cmake:55 (csfml_parse_arguments):
Syntax error in cmake code at
ð;É8ë7ð;ÉrojeèÂÀeclipse/work:55
when parsing string
SOURCES;G:/Daten/.........;G:\Daten\D-Projekte\eclipse\workspace\sfml2\install\lib;debug;G:\Daten\D-Projekte\eclipse\workspace\sfml2\install\lib
Invalid escape sequence \D
Call Stack (most recent call first):
src/SFML/System/CMakeLists.txt:24 (csfml_add_library)
-
If even SFML_INCLUDE_DIR is not found, then the SFML path you provided is probably wrong. How did you do that exactly?
-
I set SFML path to install dir with include, lib and bin.
But I think I also tried setting it to the sfml main dir once.
-
I set SFML path to install dir with include, lib and bin.
You're not answering my question, I want to know the technical details (like "I set this CMake variable to this value with that command...") ;)