include(CheckSymbolExists)

if(SCHED_SETAFFINITY_FOUND)

else()
  set(CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE)
  CHECK_SYMBOL_EXISTS(sched_setaffinity sched.h HAVE_SCHED_SETAFFINITY_INTERNAL)
  if(HAVE_SCHED_SETAFFINITY_INTERNAL)
    message(STATUS "sched_setaffinity found")
    set(SCHED_SETAFFINITY_FOUND "${HAVE_SCHED_SETAFFINITY_INTERNAL}")
    set(SCHED_SETAFFINITY_LIBRARIES rt)
  endif()
endif()
