Skip to content
Browse files

Fixed bug 2464 - Configure a together with sdl2.…



Despite having a CMakeLists.txt file, SDL2 seems to be mainly built using the autotools system by package-managers. It is nice to have it but it is only useful if you are building SDL2 by yourself.

People that want to use CMake to find their already-installed SDL2 are using a FindSDL2.cmake module based on the old FindSDL.cmake. This is not deprecated but it is discouraged by the CMake devs (see, as these modules needs maintainers to be included in the official CMake installation.

To fix that, SDL and its accompanying libraries could configure a simple sdl2-config.cmake file, much like it does with We don't need to configure a full sdl2-config.cmake as in this post, (because it depends on it being built with CMake). Using something as simple as is deemed enough. Here is another:
  • Loading branch information
slouken committed Jun 30, 2015
1 parent f1b7a84 commit bf9bd59c013ec9c2f799421ec1a410c5d35b8c38
Showing with 16 additions and 2 deletions.
  1. +3 −0
  2. +2 −1 configure
  3. +1 −1
  4. +10 −0
@@ -176,6 +176,8 @@ install-data:
$(INSTALL) -m 644 $(srcdir)/sdl2.m4 $(DESTDIR)$(datadir)/aclocal/sdl2.m4
$(SHELL) $(auxdir)/mkinstalldirs $(DESTDIR)$(libdir)/pkgconfig
$(INSTALL) -m 644 sdl2.pc $(DESTDIR)$(libdir)/pkgconfig
$(SHELL) $(auxdir)/mkinstalldirs $(DESTDIR)$(libdir)/cmake/SDL2
$(INSTALL) -m 644 sdl2-config.cmake $(DESTDIR)$(libdir)/cmake/SDL2

uninstall: uninstall-bin uninstall-hdrs uninstall-lib uninstall-data
@@ -194,6 +196,7 @@ uninstall-lib:
rm -f $(DESTDIR)$(datadir)/aclocal/sdl2.m4
rm -f $(DESTDIR)$(libdir)/pkgconfig/sdl2.pc
rm -f $(DESTDIR)$(libdir)/cmake/SDL2/sdl2-config.cmake

rm -rf $(objects)

ac_config_files="$ac_config_files sdl2-config SDL2.spec sdl2.pc"
ac_config_files="$ac_config_files sdl2-config sdl2-config.cmake SDL2.spec sdl2.pc"

ac_config_commands="$ac_config_commands sdl2_config"

"libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;;
"sdl2-config") CONFIG_FILES="$CONFIG_FILES sdl2-config" ;;
"sdl2-config.cmake") CONFIG_FILES="$CONFIG_FILES sdl2-config.cmake" ;;
"sdl2.pc") CONFIG_FILES="$CONFIG_FILES sdl2.pc" ;;
"sdl2_config") CONFIG_COMMANDS="$CONFIG_COMMANDS sdl2_config" ;;
@@ -3533,7 +3533,7 @@ $SDLTEST_DEPENDS

AC_CONFIG_FILES([ sdl2-config SDL2.spec sdl2.pc sdl2-config sdl2-config.cmake SDL2.spec sdl2.pc
AC_CONFIG_COMMANDS([sdl2_config],[chmod a+x sdl2-config])

@@ -0,0 +1,10 @@
# sdl2 cmake project-config input for ./configure scripts

set(prefix "@prefix@")
set(exec_prefix "@exec_prefix@")
set(libdir "@libdir")
set(SDL2_PREFIX "@prefix@")
set(SDL2_EXEC_PREFIX "@prefix@")
set(SDL2_LIBDIR "@libdir@")
set(SDL2_INCLUDE_DIRS "@includedir@/SDL2")

0 comments on commit bf9bd59

Please sign in to comment.