Fetch SDL2 in CMake

This commit is contained in:
2023-08-10 10:45:53 -05:00
parent d4123f440e
commit 9de914dfa8
+13 -8
View File
@@ -30,14 +30,19 @@ target_include_directories(robomaster
include 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
add_executable(robomasterapp
src/sdl.c src/sdl.c
) )
target_link_libraries(robomasterapp target_link_libraries(robomasterapp
robomaster robomaster
SDL2::SDL2-static SDL2-static
) )
endif()