All right, I think I found out thee problem. I actually need to grant read/write permission to the sfml folder. Once I did, SFML_DIR stopped being overwritten. I went overkill and just used chmod 777 -R on my lib and include folders in /usr/local/ (I will take the time to learn how to actually use chmod some day
).
Unfortunately something is still wrong. As you might have noticed, I have placed the sfml libraries in a rather unconventional place (at least, I think), which is a folder called "sfml" inside /usr/local/lib/. Now I have done this to better organize the lib folder, which would be otherwise clogged with .so files all over the place. My reasoning was that by grouping all of sfml's files in a folder, I can just do a "rm -rf sfml" and be done with it if I, for instance, need to install a different version or update the library. I don't actually know if there's a better way to accomplish this (maybe something similar to the "apt-get" packages, where everything is bundled together, but easily updatable/removable using the command line), and so I just went with the most naive solution possible.
I'm telling you all this because cmake works fine as soon as I put all the .so files directly in /usr/local/lib/ instead of /usr/local/lib/sfml. If I don't, I get this:
CMake Error at /usr/local/lib/sfml/cmake/SFML/SFMLSharedTargets.cmake:139 (message):
The imported target "sfml-system" references the file
"/usr/local/lib/lib/libsfml-system-d.so.2.5.0"
but this file does not exist. Possible reasons include:
* The file was deleted, renamed, or moved to another location.
* An install or uninstall procedure did not complete successfully.
* The installation package was faulty and contained
"/usr/local/lib/sfml/cmake/SFML/SFMLSharedTargets.cmake"
but not all the files it references.
Call Stack (most recent call first):
/usr/local/lib/sfml/cmake/SFML/SFMLConfig.cmake:116 (include)
CMakeLists.txt:14 (find_package)
-- Configuring incomplete, errors occurred!
Consequently, if I try to use ccmake, I get a new field named SFML_DOC_DIR, which doesn't seem to change the situation, whatever the value I set it to.