I wanted to run my game on other Linux machine where I had installed the newest SFML using package manager. The executable refused to work with the following error:
./space-logic-adventure: error while loading shared libraries: libsfml-system.so.2.4: cannot open shared object file: No such file or directory
It makes sense because I compiled it over a year ago using an older version of SFML. After recompiling the game from the source, it runs as intended. But is it possible to compile it once to work will all future 2.x SFML versions? I wanted to publish an executable for download and it seems I'd have to update it once in a while.
I define linking to SFML in CMakeLists.txt as follows:
find_package(SFML 2 REQUIRED audio graphics window system)
include_directories(${SFML_INCLUDE_DIR})
target_link_libraries(${PROJECT_NAME} sfml-audio sfml-graphics sfml-window sfml-system)
If what I'm asking for is not possible or sounds dumb to you, please explain; I'm not proficient in libraries/linking etc. I wouldn't want to link it statically. Bundling *.so files seems suboptimal to me, but maybe it is a proper way? That's what I do on Windows with dlls.