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

FindSDL2: Added module to locate SDL2 #149

Closed
wants to merge 1 commit into from
Closed

FindSDL2: Added module to locate SDL2 #149

wants to merge 1 commit into from

Conversation

jacekmigacz
Copy link

I tested it with both MinGW and MVSC.

@bradking
Copy link
Member

Thanks for working on this. However, as discussed here:

http://www.cmake.org/Bug/view.php?id=14826#c35508

since SDL2 builds with CMake they should provide package configuration files as documented in the cmake-packages(7) manual:

http://www.cmake.org/cmake/help/v3.2/manual/cmake-packages.7.html

CMake upstream should not have to maintain builtin knowledge about every library of every package out there, especially not those that are already CMake-aware. The place to contribute support for using SDL2 from CMake-based applications is to SDL2.

@bradking bradking closed this Mar 30, 2015
@jacekmigacz
Copy link
Author

I see. It sounds reasonable. Thanks.

@stopiccot
Copy link

But how deal with platforms where you can't install helper files to <prefix>/lib/cmake/foo-1.2/FooConfig.cmake like OS X and Windows. In real world it turns out that every project that uses SDL2 is simply maintaining their own version of FindSDL2.cmake in cmake modules dir. Taking into account that SDL2 is really widely used we can make an exception.

@bradking
Copy link
Member

bradking commented Apr 8, 2015

platforms where you can't install helper files to /lib/cmake/foo-1.2/FooConfig.cmake like OS X and Windows

The cmake-packages(7) manual I linked in my previous response explains that there are package registries and other ways for packages to make themselves findable. Every cross-platform project has this requirement. There is nothing special about SDL2 that CMake should need to know about it specifically. If SDL2 is unwilling to package itself for CMake in the intended way and prefers that all applications use a FindSDL2 module, then SDL2 should provide that module with their documentaiton for applications to use.

@ericoporto
Copy link

It would be really helpful if a Find SDL2 existed upstream, there's a huge proliferation of different versions of it in GitHub so it's a thing people have been looking forward to.

parazyd pushed a commit to maemo-leste-upstream-forks/libsdl2 that referenced this pull request Apr 24, 2021
Since SDL 2.0.6, the recommended way to link to a system copy of SDL2
from a CMake project is to behave like debian/tests/cmake-example -
use find_package(SDL2) without a FindSDL2 macro. However, not all
upstream projects that build using CMake have caught up with this yet.

This specific implementation was taken from openjk, but it's regularly
copied around, and can be found in hedgewars, spring and many other
packages:
https://codesearch.debian.net/search?q=Other+versions+link+to+-lSDL2main&literal=1

Inclusion of a vaguely similar file in CMake was rejected in
<Kitware/CMake#149>.

Reproduces: https://bugs.debian.org/951087
Signed-off-by: Simon McVittie <smcv@debian.org>
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

Successfully merging this pull request may close these issues.

4 participants