diff options
author | Vincent Rabaud <vrabaud@google.com> | 2021-01-19 11:47:57 +0100 |
---|---|---|
committer | Vincent Rabaud <vrabaud@google.com> | 2021-01-19 23:15:16 +0100 |
commit | ceddb5fc8d077fb1d5d4536012c33172645c69cf (patch) | |
tree | 34656d0e6dc4ac3cdb3ceb7a24963501def5cbea | |
parent | 289757fe1ef1dc1532568f67477b3de030ddca6d (diff) | |
download | libwebp-ceddb5fc8d077fb1d5d4536012c33172645c69cf.tar.gz |
Fix check_c_source_compiles with pthread.
Also fix the variables: we need to check for PTHREAD_PRIO_INHERIT
and PTHREAD_CREATE_JOINABLE (not PTHREAD_CREATE_UNDETACHED) and
internally use HAVE_PTHREAD_PRIO_INHERIT and PTHREAD_CREATE_JOINABLE
(and not HAVE_PTHREAD_CREATE_JOINABLE).
cmake/config.h.in actually had the right variables.
BUG=webp:498
Change-Id: Ibf6cf854337cea5781a74316024f8ff4960366d7
-rw-r--r-- | cmake/config.h.in | 4 | ||||
-rw-r--r-- | cmake/deps.cmake | 20 |
2 files changed, 10 insertions, 14 deletions
diff --git a/cmake/config.h.in b/cmake/config.h.in index 547aa4c8..3770935c 100644 --- a/cmake/config.h.in +++ b/cmake/config.h.in @@ -93,10 +93,6 @@ /* Define to the version of this package. */ #cmakedefine PACKAGE_VERSION "@PACKAGE_VERSION@" -/* Define to necessary symbol if this constant uses a non-standard name on - your system. */ -#cmakedefine PTHREAD_CREATE_JOINABLE 1 - /* Define to 1 if you have the ANSI C header files. */ #cmakedefine STDC_HEADERS 1 diff --git a/cmake/deps.cmake b/cmake/deps.cmake index 0ea836dc..fb55f048 100644 --- a/cmake/deps.cmake +++ b/cmake/deps.cmake @@ -27,18 +27,18 @@ if(NOT WEBP_BUILD_WEBP_JS) find_package(Threads) endif() if(Threads_FOUND) - if(CMAKE_USE_PTHREADS_INIT) + # work around cmake bug on QNX (https://cmake.org/Bug/view.php?id=11333) + if(CMAKE_USE_PTHREADS_INIT AND NOT CMAKE_SYSTEM_NAME STREQUAL "QNX") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pthread") endif() - foreach(PTHREAD_TEST HAVE_PTHREAD_PRIO_INHERIT PTHREAD_CREATE_UNDETACHED) - check_c_source_compiles(" - #include <pthread.h> - int main (void) { - int attr = ${PTHREAD_TEST}; - return attr; - } - " ${PTHREAD_TEST}) - endforeach() + check_c_source_compiles(" + #include <pthread.h> + int main (void) { + int attr = PTHREAD_PRIO_INHERIT; + return attr; + } + " FLAG_HAVE_PTHREAD_PRIO_INHERIT) + set(HAVE_PTHREAD_PRIO_INHERIT ${FLAG_HAVE_PTHREAD_PRIO_INHERIT}) list(APPEND WEBP_DEP_LIBRARIES ${CMAKE_THREAD_LIBS_INIT}) endif() set(WEBP_USE_THREAD ${Threads_FOUND}) |