From: Ivan Maidanski Date: Thu, 22 Aug 2019 20:30:34 +0000 (+0300) Subject: Refactoring of CMake script to use ANDROID/APPLE/CYGWIN/MSYS variables X-Git-Tag: upstream/8.0.4~106 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4ed4d8945ad19d1470b8d3aa09e2ee4dfeeacea2;p=platform%2Fupstream%2Flibgc.git 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. --- 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)