cmake: create and install SDL3::Jar target for Android

This commit is contained in:
Anonymous Maarten
2023-11-22 23:28:39 +01:00
parent 53544cabaa
commit a45b371de0
5 changed files with 42 additions and 9 deletions

View File

@@ -48,6 +48,11 @@ else()
endif()
endif()
if(ANDROID AND EXISTS "${CMAKE_CURRENT_LIST_DIR}/SDL3jarTargets.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/SDL3jarTargets.cmake")
set(SDL3_Jar_FOUND TRUE)
endif()
if(SDL3_SDL3-shared_FOUND OR SDL3_SDL3-static_FOUND)
set(SDL3_SDL3_FOUND TRUE)
endif()

View File

@@ -0,0 +1,10 @@
@PACKAGE_INIT@
set_and_check(SDL3_JAR "@PACKAGE_SDL_INSTALL_JAVADIR@/SDL3/SDL3-@SDL3_VERSION@.jar")
if(NOT TARGET SDL3::Jar)
add_library(SDL3::Jar INTERFACE IMPORTED)
set_property(TARGET SDL3::Jar PROPERTY JAR_FILE "${SDL3_JAR}")
endif()
unset(SDL3_JAR)

View File

@@ -93,4 +93,8 @@ find_package(SDL3 REQUIRED CONFIG COMPONENTS SDL3)
add_executable(gui-whatever WIN32 main_gui.c)
target_link_libraries(gui-whatever PRIVATE SDL3::SDL3)
if(ANDROID)
find_package(SDL3 REQUIRED CONFIG COMPONENTS Jar)
endif()
feature_summary(WHAT ALL)