From 81e4b59a80ad6f6ced9a16a426d3dddb06346451 Mon Sep 17 00:00:00 2001 From: Robert Date: Sat, 24 Apr 2021 14:58:02 +0200 Subject: [PATCH] Made cmake platform independent --- CMakeLists.txt | 8 ++++++-- lib/sdl2_gfx/CMakeLists.txt | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 47bddaf..9a94e91 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,6 +4,12 @@ project(sdlu) find_package(SDL2 CONFIG REQUIRED) +if(WIN32) + set(SDL2_PREFIX SDL2::) +else() + set(SDL2_PREFIX "") +endif() + option(BUILD_EXAMPLES "Builds the example projects" ON) add_subdirectory(lib/sdl2_gfx) @@ -22,13 +28,11 @@ add_library(sdlu target_include_directories(sdlu PUBLIC "include" - ${SDL2_INCLUDE_DIRS} sdl2_gfx ) target_link_libraries(sdlu PUBLIC sdl2_gfx - SDL2 SDL2main ) if(BUILD_EXAMPLES) diff --git a/lib/sdl2_gfx/CMakeLists.txt b/lib/sdl2_gfx/CMakeLists.txt index 124f011..617d0aa 100644 --- a/lib/sdl2_gfx/CMakeLists.txt +++ b/lib/sdl2_gfx/CMakeLists.txt @@ -11,10 +11,10 @@ add_library(sdl2_gfx ) target_include_directories(sdl2_gfx PUBLIC - ${SDL2_INCLUDE_DIRS} "include" + ${SDL2_PREFIX}SDL2 ) target_link_libraries(sdl2_gfx PUBLIC - SDL2 + ${SDL2_PREFIX}SDL2 ${SDL2_PREFIX}SDL2main )