SDL: cmake: Solaris' SunPro has alternative way to link to pthread libraries (e02f6)

From e02f651c05cbef12f059f322543dc773640704df Mon Sep 17 00:00:00 2001
From: Anonymous Maarten <[EMAIL REDACTED]>
Date: Sat, 28 Dec 2024 03:46:10 +0100
Subject: [PATCH] cmake: Solaris' SunPro has alternative way to link to pthread
 libraries

Fixes libsdl-org/SDL#10096

(cherry picked from commit 4fbd6cba6051a8b5d5180f1f7f86b60971e6202d)
---
 cmake/sdlchecks.cmake | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/cmake/sdlchecks.cmake b/cmake/sdlchecks.cmake
index 47c94af5df7fa..ac36cfa2d7ed1 100644
--- a/cmake/sdlchecks.cmake
+++ b/cmake/sdlchecks.cmake
@@ -963,7 +963,11 @@ macro(CheckPTHREAD)
       set(PTHREAD_LDFLAGS "-lpthread")
     elseif(SOLARIS)
       set(PTHREAD_CFLAGS "-D_REENTRANT")
-      set(PTHREAD_LDFLAGS "-pthread -lposix4")
+      if(CMAKE_C_COMPILER_ID MATCHES "SunPro")
+        set(PTHREAD_LDFLAGS "-mt -lpthread")
+      else()
+        set(PTHREAD_LDFLAGS "-pthread -lposix4")
+      endif()
     elseif(SYSV5)
       set(PTHREAD_CFLAGS "-D_REENTRANT -Kthread")
       set(PTHREAD_LDFLAGS "")