From: Colin Finck Date: Tue, 16 Feb 2021 15:03:04 +0000 (-0500) Subject: [libc++] Build thread_win32.cpp only if LIBCXX_HAS_PTHREAD_API is not set X-Git-Tag: llvmorg-14-init~15000 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0f5020af7f347f029b5687f7a6d3b72174995d59;p=platform%2Fupstream%2Fllvm.git [libc++] Build thread_win32.cpp only if LIBCXX_HAS_PTHREAD_API is not set This allows building libc++ against winpthreads from mingw-w64 to support operating systems older than Windows 7. The remaining libc++ code already supports `WIN32` with `LIBCXX_HAS_PTHREAD_API`. Note that there is also the older "pthreads-win32". However, that support library implements `pthread_t` as a struct, which violates the libc++ assumption that `pthread_t` is always a scalar and can be compared, ordered, and set to zero. Differential Revision: https://reviews.llvm.org/D96339 --- diff --git a/libcxx/src/CMakeLists.txt b/libcxx/src/CMakeLists.txt index 76227d3..cfb7eb1 100644 --- a/libcxx/src/CMakeLists.txt +++ b/libcxx/src/CMakeLists.txt @@ -77,8 +77,13 @@ if(WIN32) list(APPEND LIBCXX_SOURCES support/win32/locale_win32.cpp support/win32/support.cpp - support/win32/thread_win32.cpp ) + + if (NOT LIBCXX_HAS_PTHREAD_API) + list(APPEND LIBCXX_SOURCES + support/win32/thread_win32.cpp + ) + endif() elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "SunOS") list(APPEND LIBCXX_SOURCES support/solaris/mbsnrtowcs.inc