sdl2-config.cmake.in
author Sam Lantinga <slouken@libsdl.org>
Mon, 29 Jun 2015 22:24:00 -0700
changeset 9785 6e87ae760e6d
child 9978 a80ea42a4adc
permissions -rw-r--r--
Fixed bug 2464 - Configure a sdl2-config.cmake.in together with sdl2.pc.in

Leonardo

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 http://www.cmake.org/Bug/view.php?id=14826), 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 sdl2.pc.in. We don't need to configure a full sdl2-config.cmake as in this post, http://forums.libsdl.org/viewtopic.php?t=10068&sid=ccf8abbf0d73fb03ae9cded991e60959 (because it depends on it being built with CMake). Using something as simple as http://www.cmake.org/Wiki/CMake/Tutorials/Packaging#Package_Configuration_Files is deemed enough. Here is another: http://quickgit.kde.org/?p=prison.git&a=blob&f=lib%2Fprison%2FPrisonConfig.cmake.in
slouken@9785
     1
# sdl2 cmake project-config input for ./configure scripts
slouken@9785
     2
slouken@9785
     3
set(prefix "@prefix@") 
slouken@9785
     4
set(exec_prefix "@exec_prefix@")
slouken@9785
     5
set(libdir "@libdir")
slouken@9785
     6
set(SDL2_PREFIX "@prefix@")
slouken@9785
     7
set(SDL2_EXEC_PREFIX "@prefix@")
slouken@9785
     8
set(SDL2_LIBDIR "@libdir@")
slouken@9785
     9
set(SDL2_INCLUDE_DIRS "@includedir@/SDL2")
slouken@9785
    10
set(SDL2_LIBRARIES "-L${SDL2_LIBDIR} @SDL_RLD_FLAGS@ @SDL_LIBS@")