From f5887513fd9ef911ffc556e1bc1ec36ab1308ecf Mon Sep 17 00:00:00 2001 From: Christopher Snowhill Date: Fri, 28 Jul 2017 21:49:31 -0700 Subject: [PATCH] =?UTF-8?q?Fix=20CMakeFile.txt=20for=20SDL2=20supplied=20S?= =?UTF-8?q?DL2-config.cmake,=20which=20is=20inclu=E2=80=A6=20(#830)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 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. --- src/platform/sdl/CMakeLists.txt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/platform/sdl/CMakeLists.txt b/src/platform/sdl/CMakeLists.txt index 8161362ad..0922dec62 100644 --- a/src/platform/sdl/CMakeLists.txt +++ b/src/platform/sdl/CMakeLists.txt @@ -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})