SDL_rtf: cmake: only look for SDL2_ttf when the target is not available

From ee8992cb3130e9ebb2d06942ed5df3640795986c Mon Sep 17 00:00:00 2001
From: Anonymous Maarten <[EMAIL REDACTED]>
Date: Sat, 23 Jul 2022 17:18:36 +0200
Subject: [PATCH] cmake: only look for SDL2_ttf when the target is not
 available

---
 CMakeLists.txt | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index a8380dc..5296cca 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -70,7 +70,9 @@ else()
 endif()
 
 sdl_find_sdl2(${sdl2_target_name} ${SDL_REQUIRED_VERSION})
-find_package(SDL2_ttf REQUIRED)
+if(NOT TARGET ${sdl2ttf_target_name})
+    find_package(SDL2_ttf REQUIRED)
+endif()
 
 add_library(SDL2_rtf
     rtfactn.c