Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Trouble installing SFML 2.5.1 on Mac for CLion/CMake  (Read 3032 times)

0 Members and 2 Guests are viewing this topic.

Limeoats

  • Newbie
  • *
  • Posts: 4
    • View Profile
    • Limeoats
Trouble installing SFML 2.5.1 on Mac for CLion/CMake
« on: December 28, 2018, 09:55:25 pm »
I'm having trouble installing SFML 2.5.1 on my Mac to use with CLion / CMake. I downloaded it from the Downloads page but noticed that it does not contain the new SFMLConfig.cmake. I tried moving the downloaded folder into my /Library/Frameworks folder and adding the SFMLConfig.cmake manually, but that did not work.

I should also point out that I checked the tutorials and none of them mention the SFMLConfig.cmake, so I wasn't able to get any help there.

I can probably make it work fine with a FindSFML.cmake file, but I'd rather get it working the correct way since FindSFML.cmake is deprecated. Why is SFMLConfig.cmake missing?
« Last Edit: December 28, 2018, 10:36:11 pm by Limeoats »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
Re: Trouble installing SFML 2.5.1 on Mac for CLion/CMake
« Reply #1 on: December 31, 2018, 10:17:46 am »
The config files are there, but they seem a bit hidden: Frameworks\SFML.framework\Versions\2.5.1\Resources\CMake\

When I build CSFML on macOS a few weeks ago, I had trouble using them, but I'm not sure if it was just be being bad with macOS, whether CSFML needs some changes or if there's indeed some issue with them.
Let me know if they worked for you. :)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Limeoats

  • Newbie
  • *
  • Posts: 4
    • View Profile
    • Limeoats
Re: Trouble installing SFML 2.5.1 on Mac for CLion/CMake
« Reply #2 on: December 31, 2018, 11:23:07 pm »
The config files are there, but they seem a bit hidden: Frameworks\SFML.framework\Versions\2.5.1\Resources\CMake\

When I build CSFML on macOS a few weeks ago, I had trouble using them, but I'm not sure if it was just be being bad with macOS, whether CSFML needs some changes or if there's indeed some issue with them.
Let me know if they worked for you. :)

Thank you, that was helpful and I was actually able to get it working with this information. I had to make a few tweaks though. I may just be doing something wrong / unnecessary, but this worked for me.

I put the whole folder I downloaded into ~/Library/Frameworks, and I had to set the SFML_DIR variable as you mentioned in your other post about upgrading:

set(SFML_DIR "~/Library/Frameworks/SFML/Frameworks/SFML.framework/Versions/2.5.1/Resources/CMake")

Once I did this, the SFMLConfig.cmake was found but the relative paths were still messed up a bit. I was able to fix them by going into SFMLSharedTargets.cmake and adding the following line two more times:

get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)

in the section called
# Compute the installation prefix relative to this file.

This modified the relative path to be correct based on filesystem. I'm not sure if this is a bug or just the way I set everything up, but hopefully this can help others experiencing similar issues.

Thanks again for pointing me in the right direction!