FindThreads: avoid failing in AIX when using -D_XOPEN_SOURCE=500

Current FindThreads fails in AIX (tested on 7.1 and 7.2) when using
additional compilation flags (ex: -D_XOPEN_SOURCE=500) because the
linker might need additional flags to link and those aren't yet known
by the time check_include("pthread.h") is run (which is also the first
test).

Remove the check for it and all supporting code and rely instead on
the compilation test that will be done later to find the correct
syntax to use, and that confirms it exists implicitly.
This commit is contained in:
Carlo Marcelo Arenas Belón 2022-04-30 21:21:43 -07:00 committed by Brad King
parent 833e952583
commit 3257c34073

View File

@ -156,19 +156,6 @@ macro(_threads_check_flag_pthread)
endif()
endmacro()
# Do we have pthreads?
if(CMAKE_C_COMPILER_LOADED)
CHECK_INCLUDE_FILE("pthread.h" CMAKE_HAVE_PTHREAD_H)
else()
CHECK_INCLUDE_FILE_CXX("pthread.h" CMAKE_HAVE_PTHREAD_H)
endif()
if(CMAKE_HAVE_PTHREAD_H)
#
# We have pthread.h
# Let's check for the library now.
#
# Check if pthread functions are in normal C library.
# We list some pthread functions in PTHREAD_C_CXX_TEST_SOURCE test code.
# If the pthread functions already exist in C library, we could just use
@ -191,7 +178,6 @@ if(CMAKE_HAVE_PTHREAD_H)
if (NOT THREADS_PREFER_PTHREAD_FLAG)
_threads_check_flag_pthread()
endif()
endif()
if(CMAKE_THREAD_LIBS_INIT OR CMAKE_HAVE_LIBC_PTHREAD)
set(CMAKE_USE_PTHREADS_INIT 1)