CSFML icon indicating copy to clipboard operation
CSFML copied to clipboard

Add instructions to link CSFML via CMAKE

Open astrolemonade opened this issue 5 years ago • 7 comments

Hello ! I tried to link CSFML to my C project via CMAKE but I wasn't able to get it to work ! I searched for instructions on the internet but I didn't find anything really helpful.

astrolemonade avatar Apr 08 '20 07:04 astrolemonade

Please include new installation instructions please. Since SFML upgraded their CMAKE scripts it can no longer compile. You still reference findSFML.cmake which has been removed since 2018

leonardbillywoodiii avatar Nov 28 '20 05:11 leonardbillywoodiii

I’m trying to link to CSFML via CMake FetchContent module. However, it cannot find the SFML or CSFMLConfig.cmake, even with SFML_DIR set (I’m also including SFML with FetchContent and setting SFML_DIR to sfml_SOURCE_DIR).

Please could you advise on how to link to CSFML without having to install the library?

junglie85 avatar Aug 30 '21 10:08 junglie85

I'm not sure this is possible without modifying the CSFML CMakeLists.txt The reason being that CSFML will use find_package() to locate SFML and that doesn't really work in combination with your FetchContent call.

One change one could consider adding to CSFML is a check of whether the SFML CMake targets already exist, before (unnecessarily) calling find_package.

eXpl0it3r avatar Aug 30 '21 11:08 eXpl0it3r

Why is it that no one will fix this issue or explain how to get CMAKE to work? There have been request after request. If it's broken, why is it even in there then? Or, if it has been solved, where, how, explain????

jarroddavis68 avatar Dec 28 '21 18:12 jarroddavis68

Check Raylib, SFML might not be your thing when using C https://github.com/raysan5/raylib

astrolemonade avatar Dec 28 '21 18:12 astrolemonade

I'm using (trying to use) it from Delphi (must use CSFML). I'm just trying to get everything compiled. Why does it have to be so difficult? I can build SFML easy enough, but I read where the CMAKE script has changed which prevents CMAKE from working with CSFML. So how does one create a visual studio solution, then can compile CSFML?

jarroddavis68 avatar Dec 28 '21 19:12 jarroddavis68

  • CMake provides in its errors all the necessary information on how to link SFML
  • The readme has been updated to include the necessary instructions
  • You link SFML like you would for any other application
  • The whole CMake config + find_package() isn't something exclusive to SFML or CSFML, it's a common CMake operation

eXpl0it3r avatar Dec 28 '21 22:12 eXpl0it3r

I'll close this for now. If you have any additional ideas for improvement, let me know.

eXpl0it3r avatar Oct 26 '22 21:10 eXpl0it3r