- Go to SFML GitHub page https://github.com/SFML/SFML
- Change the branch to the version you want to build, or keep in master to build most recent
- Download the zip file for that branch
- Extract any where, I like
~/SFML-versionX
- Open
cmake-gui(install withapt install cmake-qt-gui, run withcmake-gui) - Field "Where is the source code":
~/SFML-versionX - Field "WHere to build the binaries":
~/SFML-versionX/build(create if it doesn't exist) - Click
Configure - If this is the first time, select generator
Unix Makefiles - Options will be red
- Change values, like
CMAKE_BUILD_TYPEfrom Release to Debug, and others - Pay attention to
CMAKE_INSTALL_PREFIX - Click
Configureagain, options will be normal - Click
Generate - In terminal,
cd ~/SFML-versionX/build make cleanmakesudo make install
- When executing g++ Linker, make sure to use the
CMAKE_INSTALL_PREFIX/libto do the linking, example:
- If
CMAKE_INSTALL_PREFIX = /usr/local, use-L/usr/local/libwhen linking g++ main.o -o final_program -L/usr/local/lib -lsfml-graphics- When running, make sure it is in LD_LIBRARY_PATH
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib