From 43b49da5529f8eaa27fb79d0e25ff87701e4762a Mon Sep 17 00:00:00 2001 From: Noel Berry Date: Sun, 3 Jan 2021 00:10:53 -0800 Subject: [PATCH] attempting to solve SDL2 include dirs across platforms --- CMakeLists.txt | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f6e8831..8c7dd9f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -70,8 +70,6 @@ target_include_directories(blah # Platform Variables set(SDL2_ENABLED true CACHE BOOL "Use SDL2 as the System implementation") -set(SDL2_INCLUDE_DIRS "" CACHE FILEPATH "SDL2 Headers") -set(SDL2_LIBRARIES "" CACHE FILEPATH "SDL2 Headers") set(OPENGL_ENABLED true CACHE BOOL "Use OpenGL graphics implementation") set(D3D11_ENABLED false CACHE BOOL "Use D3D11 graphics implementation") @@ -88,9 +86,14 @@ if (D3D11_ENABLED) set(LIBS ${LIBS} d3d11.lib dxguid.lib D3Dcompiler.lib) endif() -# Link and create SDL2 Definition if we're using SDL2 +# Link and create SDL2 Definition if we're using it if (SDL2_ENABLED) add_compile_definitions(BLAH_USE_SDL2) + + if (NOT DEFINED SDL2_INCLUDE_DIRS OR NOT DEFINED SDL2_LIBRARIES) + find_package(SDL2 REQUIRED) + endif() + target_include_directories(blah PUBLIC "$") set(LIBS ${LIBS} ${SDL2_LIBRARIES}) endif()