@@ -545,10 +545,29 @@ if(SDLTTF_INSTALL)
545
545
endif ()
546
546
547
547
if (SDLTTF_SAMPLES )
548
- add_executable (glfont examples/glfont.c )
549
- add_executable (showfont examples/showfont.c examples/editbox.c )
550
- add_executable (testapp examples/testapp.c )
551
- add_executable (testgputext examples/testgputext.c )
548
+ function (add_sdl_ttf_example_executable TARGET )
549
+ if (ANDROID )
550
+ add_library (${TARGET} SHARED ${ARGN} )
551
+ else ()
552
+ add_executable (${TARGET} ${ARGN} )
553
+ endif ()
554
+ sdl_add_warning_options (${TARGET} WARNING_AS_ERROR ${SDLTTF_WERROR} )
555
+ target_link_libraries (${TARGET} PRIVATE SDL3_ttf::${sdl3_ttf_target_name} )
556
+ target_link_libraries (${TARGET} PRIVATE ${sdl3_target_name} )
557
+ if ("c_std_99" IN_LIST CMAKE_C_COMPILE_FEATURES )
558
+ target_compile_features (${TARGET} PRIVATE c_std_99 )
559
+ endif ()
560
+
561
+ if (SDLTTF_SAMPLES_INSTALL )
562
+ install (TARGETS ${TARGET}
563
+ RUNTIME DESTINATION "${CMAKE_INSTALL_LIBEXECDIR} /installed-tests/SDL3_ttf"
564
+ )
565
+ endif ()
566
+ endfunction ()
567
+ add_sdl_ttf_example_executable (glfont examples/glfont.c )
568
+ add_sdl_ttf_example_executable (showfont examples/showfont.c examples/editbox.c )
569
+ add_sdl_ttf_example_executable (testapp examples/testapp.c )
570
+ add_sdl_ttf_example_executable (testgputext examples/testgputext.c )
552
571
553
572
set (OpenGL_GL_PREFERENCE GLVND )
554
573
find_package (OpenGL )
@@ -559,21 +578,6 @@ if(SDLTTF_SAMPLES)
559
578
target_compile_definitions (glfont PRIVATE HAVE_OPENGL )
560
579
target_link_libraries (glfont PRIVATE OpenGL::GL )
561
580
endif ()
562
-
563
- foreach (prog glfont showfont testapp testgputext )
564
- sdl_add_warning_options (${prog} WARNING_AS_ERROR ${SDLTTF_WERROR} )
565
- target_link_libraries (${prog} PRIVATE SDL3_ttf::${sdl3_ttf_target_name} )
566
- target_link_libraries (${prog} PRIVATE ${sdl3_target_name} )
567
- if ("c_std_99" IN_LIST CMAKE_C_COMPILE_FEATURES )
568
- target_compile_features (${prog} PRIVATE c_std_99 )
569
- endif ()
570
-
571
- if (SDLTTF_SAMPLES_INSTALL )
572
- install (TARGETS ${prog}
573
- RUNTIME DESTINATION "${CMAKE_INSTALL_LIBEXECDIR} /installed-tests/SDL3_ttf"
574
- )
575
- endif ()
576
- endforeach ()
577
581
endif ()
578
582
579
583
set (available_deps )
0 commit comments