32 lines
964 B
Diff
32 lines
964 B
Diff
--- cmake/FindPthreads.cmake 2012-02-27 21:11:05.000000000 +0100
|
|
+++ cmake/FindPthreads.cmake 2016-03-08 04:46:38.516378187 +0100
|
|
@@ -27,7 +27,7 @@
|
|
SET(_aix_flags "-D_THREAD_SAFE:-lpthreads")
|
|
|
|
# gcc on various OSes
|
|
- SET(_other_flags "-pthread:-pthread")
|
|
+ SET(_other_flags "-pthread -fPIC:-pthread")
|
|
|
|
IF(CMAKE_SYSTEM_NAME MATCHES "AIX.*")
|
|
LIST(APPEND _available_flags ${_aix_flags})
|
|
@@ -59,14 +59,17 @@
|
|
|
|
FILE(WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/TestPthreads.c
|
|
"#include <pthread.h>\n"
|
|
+ "void* start_routine(void* arg) { return arg; }\n"
|
|
"int main()\n"
|
|
"{\n"
|
|
" pthread_t th;\n"
|
|
- " pthread_create(&th, 0, 0, 0);\n"
|
|
+ " pthread_attr_t att;\n"
|
|
+ " pthread_attr_init(&att);\n"
|
|
+ " pthread_create(&th, &att, start_routine, 0);\n"
|
|
" pthread_join(th, 0);\n"
|
|
- " pthread_attr_init(0);\n"
|
|
" pthread_cleanup_push(0, 0);\n"
|
|
" pthread_cleanup_pop(0);\n"
|
|
+ " return 0;\n"
|
|
"}\n"
|
|
)
|
|
|