Fix CMakeFile.txt for SDL2 supplied SDL2-config.cmake, which is inclu… (#830)

* Fix CMakeFile.txt for SDL2 supplied SDL2-config.cmake, which is included with version 2.0.4 and newer.

* Fall back to pkgconfig for ancient releases that are stuck on pre-2.0.4 SDL.
This commit is contained in:
Christopher Snowhill 2017-07-28 21:49:31 -07:00 committed by endrift
parent dd5ca4031c
commit f5887513fd
1 changed files with 5 additions and 2 deletions

View File

@ -1,8 +1,11 @@
set(SDL_VERSION "2" CACHE STRING "Version of SDL to use (1.2 or 2)")
if (SDL_VERSION EQUAL "2")
include(FindPkgConfig)
pkg_search_module(SDL2 sdl2)
find_package(SDL2)
if (NOT SDL2_FOUND)
include(FindPkgConfig)
pkg_search_module(SDL2 sdl2)
endif()
if (SDL2_FOUND)
set(SDL_INCLUDE_DIR ${SDL2_INCLUDE_DIRS})
set(SDL_LIBRARY ${SDL2_LIBRARIES})