summaryrefslogtreecommitdiffstats
path: root/Modules/FindThreads.cmake
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2019-12-05 16:39:54 (GMT)
committerKitware Robot <kwrobot@kitware.com>2019-12-05 16:40:35 (GMT)
commit158839f0db905d44a4dd7d37e7bb36c1899fd17c (patch)
treece3fd368d10e1c24efc47a6ecc056db7d750f3e5 /Modules/FindThreads.cmake
parent684ad4296d28750b2ea27f723a8d8c8f6ceb5365 (diff)
parentf7ffefea7c838731c958f6493c241ea6e8239418 (diff)
downloadCMake-158839f0db905d44a4dd7d37e7bb36c1899fd17c.zip
CMake-158839f0db905d44a4dd7d37e7bb36c1899fd17c.tar.gz
CMake-158839f0db905d44a4dd7d37e7bb36c1899fd17c.tar.bz2
Merge topic 'FindThreads-lib-flag' into release-3.16
f7ffefea7c FindThreads: Restore hard-coded '-l' flag on library name Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !4112
Diffstat (limited to 'Modules/FindThreads.cmake')
-rw-r--r--Modules/FindThreads.cmake8
1 files changed, 4 insertions, 4 deletions
diff --git a/Modules/FindThreads.cmake b/Modules/FindThreads.cmake
index d39fe33..b0c91b2 100644
--- a/Modules/FindThreads.cmake
+++ b/Modules/FindThreads.cmake
@@ -77,7 +77,7 @@ macro(_check_threads_lib LIBNAME FUNCNAME VARNAME)
if(NOT Threads_FOUND)
CHECK_LIBRARY_EXISTS(${LIBNAME} ${FUNCNAME} "" ${VARNAME})
if(${VARNAME})
- set(CMAKE_THREAD_LIBS_INIT "${LIBNAME}")
+ set(CMAKE_THREAD_LIBS_INIT "-l${LIBNAME}")
set(CMAKE_HAVE_THREADS_LIBRARY 1)
set(Threads_FOUND TRUE)
endif()
@@ -88,7 +88,7 @@ endmacro()
# Do NOT even think about using it outside of this file!
macro(_check_pthreads_flag)
if(NOT Threads_FOUND)
- # If we did not find a thread library look for -pthread compiler option.
+ # If we did not found -lpthread, -lpthread, or -lthread, look for -pthread
if(NOT DEFINED THREADS_HAVE_PTHREAD_ARG)
message(STATUS "Check if compiler accepts -pthread")
if(CMAKE_C_COMPILER_LOADED)
@@ -164,7 +164,7 @@ if(CMAKE_HAVE_PTHREAD_H)
_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 thread library with thr_create
+ # On sun also check for -lthread
_check_threads_lib(thread thr_create CMAKE_HAVE_THR_CREATE)
endif()
endif()
@@ -195,7 +195,7 @@ if(CMAKE_USE_PTHREADS_INIT)
# are available.
CHECK_LIBRARY_EXISTS(cma pthread_attr_create "" CMAKE_HAVE_HP_CMA)
if(CMAKE_HAVE_HP_CMA)
- set(CMAKE_THREAD_LIBS_INIT "cma")
+ set(CMAKE_THREAD_LIBS_INIT "-lcma")
set(CMAKE_HP_PTHREADS_INIT 1)
set(Threads_FOUND TRUE)
endif()