From 4ed4d8945ad19d1470b8d3aa09e2ee4dfeeacea2 Mon Sep 17 00:00:00 2001 From: Ivan Maidanski Date: Thu, 22 Aug 2019 23:30:34 +0300 Subject: [PATCH] Refactoring of CMake script to use ANDROID/APPLE/CYGWIN/MSYS variables * CMakeLists.txt [CMAKE_USE_PTHREADS_INIT]: Replace "HOST MATCHES .*-.*-android.*", "HOST MATCHES .*-.*-cygwin.*", "HOST MATCHES .*-.*-darwin.*", "HOST MATCHES .*-.*-msys.*" with ANDROID, CYGWIN, APPLE and MSYS variables, respectively; add comment that ANDROID is defined only starting from cmake-3.7.0; remove commented out darwin_threads variable assignment. --- CMakeLists.txt | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0030e43..3403bf8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -122,7 +122,7 @@ endif() if (CMAKE_USE_PTHREADS_INIT) set(SRC ${SRC} pthread_start.c pthread_support.c pthread_stop_world.c) # Common defines for most POSIX platforms. - if (HOST MATCHES .*-.*-aix.*|.*-.*-android.*|.*-.*-cygwin.*|.*-.*-darwin.*|.*-.*-.*freebsd.*|.*-.*-haiku.*|.*-.*-gnu.*|.*-.*-hpux11.*|.*-.*-irix.*|.*-.*-.*linux.*|.*-.*-msys.*|.*-.*-nacl.*|.*-.*-netbsd.*|.*-.*-openbsd.*|.*-.*-osf.*|.*-.*-solaris.*) + if (ANDROID OR APPLE OR CYGWIN OR MSYS OR HOST MATCHES .*-.*-aix.*|.*-.*-.*freebsd.*|.*-.*-haiku.*|.*-.*-gnu.*|.*-.*-hpux11.*|.*-.*-irix.*|.*-.*-.*linux.*|.*-.*-nacl.*|.*-.*-netbsd.*|.*-.*-openbsd.*|.*-.*-osf.*|.*-.*-solaris.*) add_definitions("-DGC_THREADS -D_REENTRANT") if (enable_parallel_mark) add_definitions("-DPARALLEL_MARK") @@ -145,17 +145,13 @@ if (CMAKE_USE_PTHREADS_INIT) message("Only on NetBSD 2.0 or later.") add_definitions("-D_PTHREADS") endif() - if (HOST MATCHES .*-.*-android.*) + if (ANDROID) # ANDROID variable is defined by CMake v3.7.0+. # Android NDK does not provide pthread_atfork. - elseif (HOST MATCHES .*-.*-aix.*|.*-.*-cygwin.*|.*-.*-freebsd.*|.*-.*-haiku.*|.*-.*-hpux11.*|.*-.*-irix.*|.*-.*-kfreebsd.*-gnu|.*-.*-.*linux.*|.*-.*-netbsd.*|.*-.*-openbsd.*|.*-.*-osf.*|.*-.*-solaris.*) + elseif (CYGWIN OR HOST MATCHES .*-.*-aix.*|.*-.*-freebsd.*|.*-.*-haiku.*|.*-.*-hpux11.*|.*-.*-irix.*|.*-.*-kfreebsd.*-gnu|.*-.*-.*linux.*|.*-.*-netbsd.*|.*-.*-openbsd.*|.*-.*-osf.*|.*-.*-solaris.*) if (enable_handle_fork) add_definitions("-DHANDLE_FORK") endif(enable_handle_fork) - endif() - if (HOST MATCHES .*-.*-cygwin.*|.*-.*-msys.*) - set(SRC ${SRC} win32_threads.c) - endif() - if (HOST MATCHES .*-.*-darwin.*) + elseif (APPLE) if (enable_handle_fork) # The incremental mode conflicts with fork handling. if (enable_parallel_mark) @@ -163,11 +159,13 @@ if (CMAKE_USE_PTHREADS_INIT) endif() endif(enable_handle_fork) set(SRC ${SRC} darwin_stop_world.c) - #TODO darwin_threads=true endif() if (enable_sigrt_signals) add_definitions("-DGC_USESIGRT_SIGNALS") endif() + if (CYGWIN OR MSYS) + set(SRC ${SRC} win32_threads.c) + endif() endif(CMAKE_USE_PTHREADS_INIT) if (CMAKE_USE_WIN32_THREADS_INIT) -- 2.7.4