CMake/Modules/CheckForPthreads.c
Steffen Dettmer d4e551a90b FindThreads: Drop try_run to improve cross-compiling support
Use `try_compile` instead of `try_run`.  It is not clear why `try_run`
was ever needed, and it does not work during cross-compiling.

Update the check's source file to remove code associated with actually
running things.  Also remove the ancient `__CLASSIC_C__` code path and
use a simple `int main(void)` as in `Modules/CheckIncludeFile.c.in`.

Fixes: #16920
2017-08-30 11:15:26 -04:00

16 lines
273 B
C

#include <pthread.h>
void* start_routine(void* args)
{
return args;
}
int main(void)
{
/* This is a compile and link test, no code to actually run things. */
pthread_t thread;
pthread_create(&thread, 0, start_routine, 0);
pthread_join(thread, 0);
return 0;
}