summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2018-12-07 18:28:45 (GMT)
committerBrad King <brad.king@kitware.com>2018-12-07 18:33:01 (GMT)
commit83dab0c123c0831c736fed5de3c24c2168e40541 (patch)
tree7e5cf3bbcd93c39f24553a869647a960fac853b2
parent99a224e3ee0b6a770c388313a7b32746a95514e8 (diff)
downloadCMake-83dab0c123c0831c736fed5de3c24c2168e40541.zip
CMake-83dab0c123c0831c736fed5de3c24c2168e40541.tar.gz
CMake-83dab0c123c0831c736fed5de3c24c2168e40541.tar.bz2
FindThreads: Drop IRIX-specific options and results
We do not need to support IRIX anymore, so drop relevant parts. In particular, the `CMAKE_THREAD_PREFER_PTHREAD` is frequently confused with `THREADS_PREFER_PTHREAD_FLAG`. Also remove references to the IRIX-specific options and results from other modules and tests.
-rw-r--r--Modules/CMakeBackwardCompatibilityC.cmake4
-rw-r--r--Modules/FindCUDA.cmake13
-rw-r--r--Modules/FindDCMTK.cmake1
-rw-r--r--Modules/FindThreads.cmake104
-rw-r--r--Modules/Qt4ConfigDependentSettings.cmake1
-rw-r--r--Tests/FindThreads/C-only/CMakeLists.txt1
-rw-r--r--Tests/FindThreads/CXX-only/CMakeLists.txt1
7 files changed, 44 insertions, 81 deletions
diff --git a/Modules/CMakeBackwardCompatibilityC.cmake b/Modules/CMakeBackwardCompatibilityC.cmake
index 5d86d73..775a513 100644
--- a/Modules/CMakeBackwardCompatibilityC.cmake
+++ b/Modules/CMakeBackwardCompatibilityC.cmake
@@ -59,9 +59,6 @@ if(NOT CMAKE_SKIP_COMPATIBILITY_TESTS)
set (CMAKE_HP_PTHREADS ${CMAKE_HP_PTHREADS_INIT} CACHE BOOL
"Use HP pthreads.")
- set (CMAKE_USE_SPROC ${CMAKE_USE_SPROC_INIT} CACHE BOOL
- "Use sproc libs.")
-
if(__ERASE_CMAKE_TRY_COMPILE_OSX_ARCHITECTURES)
set(CMAKE_TRY_COMPILE_OSX_ARCHITECTURES)
set(__ERASE_CMAKE_TRY_COMPILE_OSX_ARCHITECTURES)
@@ -72,7 +69,6 @@ mark_as_advanced(
CMAKE_HP_PTHREADS
CMAKE_THREAD_LIBS
CMAKE_USE_PTHREADS
-CMAKE_USE_SPROC
CMAKE_USE_WIN32_THREADS
CMAKE_X_CFLAGS
CMAKE_X_LIBS
diff --git a/Modules/FindCUDA.cmake b/Modules/FindCUDA.cmake
index 0f5cab4..228eed4 100644
--- a/Modules/FindCUDA.cmake
+++ b/Modules/FindCUDA.cmake
@@ -875,11 +875,7 @@ endif()
if(CUDA_USE_STATIC_CUDA_RUNTIME)
if(UNIX)
- # Check for the dependent libraries. Here we look for pthreads.
- if (DEFINED CMAKE_THREAD_PREFER_PTHREAD)
- set(_cuda_cmake_thread_prefer_pthread ${CMAKE_THREAD_PREFER_PTHREAD})
- endif()
- set(CMAKE_THREAD_PREFER_PTHREAD 1)
+ # Check for the dependent libraries.
# Many of the FindXYZ CMake comes with makes use of try_compile with int main(){return 0;}
# as the source file. Unfortunately this causes a warning with -Wstrict-prototypes and
@@ -890,13 +886,6 @@ if(CUDA_USE_STATIC_CUDA_RUNTIME)
find_package(Threads REQUIRED)
set(CMAKE_C_FLAGS ${_cuda_cmake_c_flags})
- if (DEFINED _cuda_cmake_thread_prefer_pthread)
- set(CMAKE_THREAD_PREFER_PTHREAD ${_cuda_cmake_thread_prefer_pthread})
- unset(_cuda_cmake_thread_prefer_pthread)
- else()
- unset(CMAKE_THREAD_PREFER_PTHREAD)
- endif()
-
if(NOT APPLE)
#On Linux, you must link against librt when using the static cuda runtime.
find_library(CUDA_rt_LIBRARY rt)
diff --git a/Modules/FindDCMTK.cmake b/Modules/FindDCMTK.cmake
index 302c089..111e0ff 100644
--- a/Modules/FindDCMTK.cmake
+++ b/Modules/FindDCMTK.cmake
@@ -200,7 +200,6 @@ if(DCMTK_oflog_LIBRARY_RELEASE OR DCMTK_oflog_LIBRARY_DEBUG)
# Hack - Not having a DCMTKConfig.cmake file to read the settings from, we will attempt to
# find the library in all cases.
# Ideally, pthread library should be discovered only if DCMTK_WITH_THREADS is enabled.
- set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
find_package(Threads)
endif()
diff --git a/Modules/FindThreads.cmake b/Modules/FindThreads.cmake
index 691b1b7..9c96a1b 100644
--- a/Modules/FindThreads.cmake
+++ b/Modules/FindThreads.cmake
@@ -12,7 +12,6 @@ The following variables are set
::
CMAKE_THREAD_LIBS_INIT - the thread library
- CMAKE_USE_SPROC_INIT - are we using sproc?
CMAKE_USE_WIN32_THREADS_INIT - using WIN32 threads?
CMAKE_USE_PTHREADS_INIT - are we using pthreads
CMAKE_HP_PTHREADS_INIT - are we using hp pthreads
@@ -23,12 +22,6 @@ The following import target is created
Threads::Threads
-For systems with multiple thread libraries, caller can set
-
-::
-
- CMAKE_THREAD_PREFER_PTHREAD
-
If the use of the -pthread compiler and linker flag is preferred then the
caller can set
@@ -55,12 +48,6 @@ else()
message(FATAL_ERROR "FindThreads only works if either C or CXX language is enabled")
endif()
-# Do we have sproc?
-if(CMAKE_SYSTEM_NAME MATCHES IRIX AND NOT CMAKE_THREAD_PREFER_PTHREAD)
- include (CheckIncludeFiles)
- CHECK_INCLUDE_FILES("sys/types.h;sys/prctl.h" CMAKE_HAVE_SPROC_H)
-endif()
-
# Internal helper macro.
# Do NOT even think about using it outside of this file!
macro(_check_threads_lib LIBNAME FUNCNAME VARNAME)
@@ -113,58 +100,53 @@ macro(_check_pthreads_flag)
endif()
endmacro()
-if(CMAKE_HAVE_SPROC_H AND NOT CMAKE_THREAD_PREFER_PTHREAD)
- # We have sproc
- set(CMAKE_USE_SPROC_INIT 1)
+# Do we have pthreads?
+if(CMAKE_C_COMPILER_LOADED)
+ CHECK_INCLUDE_FILE("pthread.h" CMAKE_HAVE_PTHREAD_H)
else()
- # 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.
- #
- set(CMAKE_HAVE_THREADS_LIBRARY)
- if(NOT THREADS_HAVE_PTHREAD_ARG)
- # Check if pthread functions are in normal C library.
- # If the pthread functions already exist in C library, we could just use
- # them instead of linking to the additional pthread library. We could
- # try to check any pthread symbol name, but here is an exception. If we
- # use clang asan build, we will find the pthread_create() symbol in the
- # libc(libasan). However, it doesn't have the full pthread implementation.
- # So, we can't assume that we have the pthread implementation in libc
- # using the pthread_create() checking here. Then, we turn to check the
- # pthread_kill() symbol instead.
- CHECK_SYMBOL_EXISTS(pthread_kill pthread.h CMAKE_HAVE_LIBC_PTHREAD_KILL)
- if(CMAKE_HAVE_LIBC_PTHREAD_KILL)
- set(CMAKE_THREAD_LIBS_INIT "")
- set(CMAKE_HAVE_THREADS_LIBRARY 1)
- set(Threads_FOUND TRUE)
- else()
-
- # Check for -pthread first if enabled. This is the recommended
- # way, but not backwards compatible as one must also pass -pthread
- # as compiler flag then.
- if (THREADS_PREFER_PTHREAD_FLAG)
- _check_pthreads_flag()
- endif ()
-
- _check_threads_lib(pthreads pthread_create CMAKE_HAVE_PTHREADS_CREATE)
- _check_threads_lib(pthread pthread_create CMAKE_HAVE_PTHREAD_CREATE)
- if(CMAKE_SYSTEM_NAME MATCHES "SunOS")
- # On sun also check for -lthread
- _check_threads_lib(thread thr_create CMAKE_HAVE_THR_CREATE)
- endif()
+ 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.
+ #
+ set(CMAKE_HAVE_THREADS_LIBRARY)
+ if(NOT THREADS_HAVE_PTHREAD_ARG)
+ # Check if pthread functions are in normal C library.
+ # If the pthread functions already exist in C library, we could just use
+ # them instead of linking to the additional pthread library. We could
+ # try to check any pthread symbol name, but here is an exception. If we
+ # use clang asan build, we will find the pthread_create() symbol in the
+ # libc(libasan). However, it doesn't have the full pthread implementation.
+ # So, we can't assume that we have the pthread implementation in libc
+ # using the pthread_create() checking here. Then, we turn to check the
+ # pthread_kill() symbol instead.
+ CHECK_SYMBOL_EXISTS(pthread_kill pthread.h CMAKE_HAVE_LIBC_PTHREAD_KILL)
+ if(CMAKE_HAVE_LIBC_PTHREAD_KILL)
+ set(CMAKE_THREAD_LIBS_INIT "")
+ set(CMAKE_HAVE_THREADS_LIBRARY 1)
+ set(Threads_FOUND TRUE)
+ else()
+
+ # Check for -pthread first if enabled. This is the recommended
+ # way, but not backwards compatible as one must also pass -pthread
+ # as compiler flag then.
+ if (THREADS_PREFER_PTHREAD_FLAG)
+ _check_pthreads_flag()
+ endif ()
+
+ _check_threads_lib(pthreads pthread_create CMAKE_HAVE_PTHREADS_CREATE)
+ _check_threads_lib(pthread pthread_create CMAKE_HAVE_PTHREAD_CREATE)
+ if(CMAKE_SYSTEM_NAME MATCHES "SunOS")
+ # On sun also check for -lthread
+ _check_threads_lib(thread thr_create CMAKE_HAVE_THR_CREATE)
endif()
endif()
-
- _check_pthreads_flag()
endif()
+
+ _check_pthreads_flag()
endif()
if(CMAKE_THREAD_LIBS_INIT OR CMAKE_HAVE_LIBC_PTHREAD_KILL)
diff --git a/Modules/Qt4ConfigDependentSettings.cmake b/Modules/Qt4ConfigDependentSettings.cmake
index 684ec21..4699ecd 100644
--- a/Modules/Qt4ConfigDependentSettings.cmake
+++ b/Modules/Qt4ConfigDependentSettings.cmake
@@ -256,7 +256,6 @@ if(Q_WS_X11)
# X11 libraries Qt always depends on
set(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${X11_Xext_LIB} ${X11_X11_LIB})
- set(CMAKE_THREAD_PREFER_PTHREAD 1)
find_package(Threads)
if(CMAKE_USE_PTHREADS_INIT)
set(QT_QTCORE_LIB_DEPENDENCIES ${QT_QTCORE_LIB_DEPENDENCIES} ${CMAKE_THREAD_LIBS_INIT})
diff --git a/Tests/FindThreads/C-only/CMakeLists.txt b/Tests/FindThreads/C-only/CMakeLists.txt
index ab4ca0d..ee2a5f9 100644
--- a/Tests/FindThreads/C-only/CMakeLists.txt
+++ b/Tests/FindThreads/C-only/CMakeLists.txt
@@ -1,7 +1,6 @@
cmake_minimum_required(VERSION 3.3 FATAL_ERROR)
project(FindThreads_C-only C)
-set(CMAKE_THREAD_PREFER_PTHREAD On)
find_package(Threads REQUIRED)
if (NOT WIN32)
diff --git a/Tests/FindThreads/CXX-only/CMakeLists.txt b/Tests/FindThreads/CXX-only/CMakeLists.txt
index 9993123..3c6cc1e 100644
--- a/Tests/FindThreads/CXX-only/CMakeLists.txt
+++ b/Tests/FindThreads/CXX-only/CMakeLists.txt
@@ -1,7 +1,6 @@
cmake_minimum_required(VERSION 3.3 FATAL_ERROR)
project(FindThreads_CXX-only CXX)
-set(CMAKE_THREAD_PREFER_PTHREAD On)
find_package(Threads REQUIRED)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/../../../Modules/CheckForPthreads.c