Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CMake does not find SFML #8

Open
minsc78 opened this issue Jun 13, 2021 · 1 comment
Open

CMake does not find SFML #8

minsc78 opened this issue Jun 13, 2021 · 1 comment

Comments

@minsc78
Copy link

minsc78 commented Jun 13, 2021

My system passed cmake's checks, but it did not compile so I had to get the latest versions of cmake, gcc, g++. Then even though I had installed SFML (sudo apt install libsfml-dev) I got this error message:

CMake Error at CMakeLists.txt:121 (find_package):
By not providing "FindSFML.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "SFML", but
CMake did not find one.

So I had to download the latest version of SFML (https://www.sfml-dev.org/download/sfml/2.5.1/) and add this to CMakeLists.txt to make it work:

set(SFML_INCLUDE_DIR "~/sfml/include")
set(SFML_LIBRARY_DIR "~/sfml/lib")
set(SFML_DIR "~/sfml/lib/cmake/SFML")
link_directories(SFML_LIBRARY_DIR)
include_directories(SFML_INCLUDE_DIR)

Why didn't it find SFML automatically on the standard installation directories?

@wenlianglaw
Copy link

wenlianglaw commented Aug 4, 2021

Create a file "FindSFML.cmake" in your Cmake Module directory, for example: "E:\Program Files\CMake\share\cmake-3.21\Modules" and then fill these, I think this will work in the future.
Seems that Cmake removed the SFML.cmake in the newer version.

...
include_directories(${SFML_INCLUDE_DIR})
link_directories(${SFML_LIB_DIR})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants