Fetch SDL2 in CMake
This commit is contained in:
+13
-8
@@ -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()
|
|
||||||
|
|||||||
Reference in New Issue
Block a user