File: CheckPthreadAffinity.cmake

package info (click to toggle)
scotch 7.0.10-6
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 25,004 kB
  • sloc: ansic: 89,593; makefile: 4,726; fortran: 2,536; yacc: 642; sh: 286; lex: 259
file content (15 lines) | stat: -rw-r--r-- 579 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
if(Threads_FOUND)
  # Save current values
  set(CMAKE_REQUIRED_INCLUDES_TMP ${CMAKE_REQUIRED_INCLUDES})
  set(CMAKE_REQUIRED_LIBRARIES_TMP ${CMAKE_REQUIRED_LIBRARIES})
  # Set flags for building test program
  set(CMAKE_REQUIRED_INCLUDES /usr/include)
  set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_THREAD_LIBS_INIT})

  include(CheckFunctionExists)

  check_function_exists(pthread_setaffinity_np PTHREAD_AFFINITY_LINUX_OK)
  # Restore previous values
  set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES_TMP})
  set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES_TMP})
endif()