Fixed bug of determining availability of functions ‘pthread_getconcurrency’, ‘pthread_setconcurrency’, ‘pthread_setaffinity_np’ in ‘pthread’ library
CMake cannot find 'pthread_getconcurrency’, ‘pthread_setconcurrency’ and ‘pthread_setaffinity_np' functions in 'pthread' library because when linking internal cmake test did’t specifed ‘-l pthread’.
This commit is contained in:
parent
a3b2f4083e
commit
2263ea5dcb
@ -33,6 +33,9 @@ ELSE()
|
||||
ADD_DEFINITIONS(-DHAVE_PTHREAD_CANCEL)
|
||||
ADD_DEFINITIONS(-DHAVE_PTHREAD_SETCANCELSTATE)
|
||||
|
||||
SET(CMAKE_REQUIRED_LIBRARIES_SAFE "${CMAKE_REQUIRED_LIBRARIES}")
|
||||
SET(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
|
||||
|
||||
CHECK_FUNCTION_EXISTS(pthread_yield HAVE_PTHREAD_YIELD)
|
||||
IF(HAVE_PTHREAD_YIELD)
|
||||
ADD_DEFINITIONS(-DHAVE_PTHREAD_YIELD)
|
||||
@ -43,6 +46,7 @@ ELSE()
|
||||
CHECK_LIBRARY_EXISTS(rt sched_yield "" HAVE_SCHED_YIELD)
|
||||
IF(HAVE_SCHED_YIELD)
|
||||
SET(CMAKE_THREAD_LIBS_INIT "${CMAKE_THREAD_LIBS_INIT} -lrt")
|
||||
SET(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES_SAFE} ${CMAKE_THREAD_LIBS_INIT})
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
IF(HAVE_SCHED_YIELD)
|
||||
@ -110,9 +114,6 @@ ELSE()
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
SET(CMAKE_REQUIRED_LIBRARIES_SAFE "${CMAKE_REQUIRED_LIBRARIES}")
|
||||
SET(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
|
||||
|
||||
ADD_LIBRARY(${LIB_NAME}
|
||||
${OPENTHREADS_USER_DEFINED_DYNAMIC_OR_STATIC}
|
||||
${TARGET_H}
|
||||
|
Loading…
Reference in New Issue
Block a user