Building with VoidCSFML on OSX
ricardobeat opened this issue · comments
cmake .
fails with
CMake Error at CMakeLists.txt:15 (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.
Could not find a package configuration file provided by "SFML" (requested
version 2) with any of the following names:
SFMLConfig.cmake
sfml-config.cmake
Add the installation prefix of "SFML" to CMAKE_PREFIX_PATH or set
"SFML_DIR" to a directory containing one of the above files. If "SFML"
provides a separate development package or SDK, be sure it has been
installed.
I had to add list(APPEND CMAKE_MODULE_PATH "/usr/local/Cellar/sfml/2.3.2/share/SFML/cmake/Modules")
to CmakeLists.txt
to make the build work. Is there any way to automate this finding step?
Also, having to compile from source now is a bit of a turn down. Do you have plans to publish voidcsfml through homebrew?
Build CrSFML
...
If SFML can't be found, make sure it is installed and consult the CMake options section.
Have you tried this?
I know that it's easy to miss but couldn't come up with a better way to write this.
I wouldn't be opposed to making a Homebrew recipe for VoidCSFML. It would be basically the same as CSFML anyway. Don't know what exactly "publishing through homebrew" entails, though. They definitely won't be (shouldn't be) interested in having this in the main repository.
And it turns out relying on Homebrew is not so nice because they have to delay SFML updates together with CSFML. You say it's a turn off to build this package manually, but maybe you wouldn't be able to use it at all otherwise, because I build pre-compiled sources only for the latest version.
ping
Sorry, yes I missed that. Homebrew does have to sync dependencies though I haven't seen that become a problem (except Lua). But yes, it's extra work to publish and wouldn't guarantee compatibility with the latest shard version, may not be worth the hassle.
Re. finding SFML, homebrew links everything under /usr/local/opt
, would you accept a patch adding
# Link to Homebrew-installed SFML on OSX
if(EXISTS "/usr/local/opt/sfml")
list(APPEND CMAKE_MODULE_PATH "/usr/local/opt/sfml/share/SFML/cmake/Modules")
endif()
to the root CMakeLists.txt
? This would make install work without any extra steps on OSX. Something similar could be done for linux distros if necessary.
That's something I didn't consider but is such a great idea. Yes, I probably would accept such a patch.
Something interesting to think about, though: both CMakeLists.txt would benefit from the exact same addition. Any way to do it without duplication and without introducing a 3rd file if possible? Also, on Linux a similar path should be checked: /usr/local/share/SFML/cmake/Modules
— perhaps a for
loop?
I added the paths like you suggested, maybe you could try it out now
Thank you! Everything works out-of-the-box now :)