From 68043dd2337feab0b0ccc9868cd535b2254335ea Mon Sep 17 00:00:00 2001 From: Brian Clinkenbeard Date: Mon, 10 Feb 2020 19:56:33 -0800 Subject: use config mode for finding SDL2 with CMake --- CMakeLists.txt | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index dc782e252..44ed4196d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -151,15 +151,16 @@ if (ENABLE_SDL2) set(SDL2_INCLUDE_DIR "${SDL2_PREFIX}/include" CACHE PATH "Path to SDL2 headers") set(SDL2_LIBRARY "${SDL2_PREFIX}/lib/x64/SDL2.lib" CACHE PATH "Path to SDL2 library") set(SDL2_DLL_DIR "${SDL2_PREFIX}/lib/x64/" CACHE PATH "Path to SDL2.dll") - else() - find_package(SDL2 REQUIRED) - endif() - if (SDL2_FOUND) - # TODO(yuriks): Make FindSDL2.cmake export an IMPORTED library instead add_library(SDL2 INTERFACE) target_link_libraries(SDL2 INTERFACE "${SDL2_LIBRARY}") target_include_directories(SDL2 INTERFACE "${SDL2_INCLUDE_DIR}") + else() + find_package(SDL2 REQUIRED) + include_directories(${SDL2_INCLUDE_DIRS}) + + add_library(SDL2 INTERFACE) + target_link_libraries(SDL2 INTERFACE "${SDL2_LIBRARIES}") endif() else() set(SDL2_FOUND NO) -- cgit v1.2.3