aboutsummaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2013-10-26 12:39:19 -0700
committerChris Robinson <[email protected]>2013-10-26 12:39:19 -0700
commitff5277f4d7057f481a820cf64e2c2db4687bfd5f (patch)
tree8ad3dcfddc5354b25c74a96011e3532b724382ac /CMakeLists.txt
parent6617985a4ee765a86d9175e0e86197c03a8f1b8c (diff)
Add a method to set the running thread's name
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt12
1 files changed, 10 insertions, 2 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ec1d4860..9ed65804 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -418,21 +418,29 @@ IF(NOT HAVE_WINDOWS_H)
# Some systems need pthread_np.h to get recursive mutexes
CHECK_INCLUDE_FILES("pthread.h;pthread_np.h" HAVE_PTHREAD_NP_H)
- CHECK_SYMBOL_EXISTS(pthread_setschedparam pthread.h HAVE_PTHREAD_SETSCHEDPARAM)
-
CHECK_C_COMPILER_FLAG(-pthread HAVE_PTHREAD)
IF(HAVE_PTHREAD)
ADD_DEFINITIONS(-pthread)
+ SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -pthread")
SET(EXTRA_LIBS ${EXTRA_LIBS} -pthread)
ENDIF()
# _GNU_SOURCE is needed on some systems for extra attributes
ADD_DEFINITIONS(-D_GNU_SOURCE=1)
+ SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -D_GNU_SOURCE=1")
+
CHECK_LIBRARY_EXISTS(pthread pthread_create "" HAVE_LIBPTHREAD)
IF(HAVE_LIBPTHREAD)
SET(EXTRA_LIBS pthread ${EXTRA_LIBS})
ENDIF()
+ CHECK_SYMBOL_EXISTS(pthread_setschedparam pthread.h HAVE_PTHREAD_SETSCHEDPARAM)
+
+ CHECK_SYMBOL_EXISTS(pthread_setname_np pthread.h HAVE_PTHREAD_SETNAME_NP)
+ IF(NOT HAVE_PTHREAD_SETNAME_NP)
+ CHECK_SYMBOL_EXISTS(pthread_set_name_np pthread.h HAVE_PTHREAD_SET_NAME_NP)
+ ENDIF()
+
CHECK_LIBRARY_EXISTS(rt clock_gettime "" HAVE_LIBRT)
IF(HAVE_LIBRT)
SET(EXTRA_LIBS rt ${EXTRA_LIBS})