From 9de914dfa8781dcaf1f80193898793827c39d1cf Mon Sep 17 00:00:00 2001 From: PgSocks Date: Thu, 10 Aug 2023 10:41:06 -0500 Subject: [PATCH] Fetch SDL2 in CMake --- CMakeLists.txt | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fc13aa0..febd117 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -30,14 +30,19 @@ target_include_directories(robomaster include ) -find_package(SDL2) +include(FetchContent) +FetchContent_Declare ( + SDL2 + GIT_REPOSITORY https://github.com/libsdl-org/SDL + GIT_TAG release-2.0.20 + GIT_SHALLOW TRUE +) +FetchContent_MakeAvailable(SDL2) -if(SDL2_FOUND) - add_executable(robomasterapp - src/sdl.c - ) - target_link_libraries(robomasterapp - robomaster - SDL2::SDL2-static - ) -endif() +add_executable(robomasterapp + src/sdl.c +) +target_link_libraries(robomasterapp + robomaster + SDL2-static +)