]> granicus.if.org Git - gc/commitdiff
Refactoring of CMake script to use ANDROID/APPLE/CYGWIN/MSYS variables
authorIvan Maidanski <ivmai@mail.ru>
Thu, 22 Aug 2019 20:30:34 +0000 (23:30 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Thu, 22 Aug 2019 20:30:34 +0000 (23:30 +0300)
* 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

index 0030e43991467389894a3a5dd7c00d5a0190954c..3403bf89eb657c8f5f758e3f9bf2960334780641 100644 (file)
@@ -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)