Build: Fix threads detection on libc with built-in support

As noted in the FindThreads documentation[0], CMAKE_THREAD_LIBS_INIT
may be empty if no special flags are needed to use thread support.
Instead, use Threads_FOUND to determine if threads are supported.

[0] https://cmake.org/cmake/help/latest/module/FindThreads.html
This commit is contained in:
Michael Forney 2020-12-25 01:02:22 -08:00 committed by Connor McLaughlin
parent 7a40a843d4
commit 8856099092
1 changed files with 1 additions and 1 deletions

View File

@ -238,7 +238,7 @@ endif()
# But for non-OSX systems, I will use the CMake Threads package.
if(NOT APPLE)
find_package(Threads QUIET)
if(NOT CMAKE_THREAD_LIBS_INIT AND NOT WIN32)
if(NOT Threads_FOUND AND NOT WIN32)
set(SDL2_THREADS_NOT_FOUND "Could NOT find Threads (Threads is required by SDL2).")
if(SDL2_FIND_REQUIRED)
message(FATAL_ERROR ${SDL2_THREADS_NOT_FOUND})