set( LIBNUMA_ROOT_DIR "" CACHE PATH "LIBNUMA root directory" )
set( DETECTED_LIBNUMA_ROOT_DIR "" )
if( NOT "${LIBNUMA_ROOT_DIR}" STREQUAL "" )
  find_path( LIBNUMA_INCLUDE_DIR numa.h  PATHS ${LIBNUMA_ROOT_DIR}/include )
  if( NOT "${LIBNUMA_INCLUDE_DIR}" STREQUAL "LIBNUMA_INCLUDE_DIR-NOTFOUND" )
    set( DETECTED_LIBNUMA_ROOT_DIR ${LIBNUMA_ROOT_DIR} )
  endif()
endif()
if( "${DETECTED_LIBNUMA_ROOT_DIR}" STREQUAL "" )
  find_path( LIBNUMA_INCLUDE_DIR numa.h  PATHS /usr/include )
  if( NOT "${LIBNUMA_INCLUDE_DIR}" STREQUAL "LIBNUMA_INCLUDE_DIR-NOTFOUND" )
    set( DETECTED_LIBNUMA_ROOT_DIR /usr )
  endif()
endif()
if( "${DETECTED_LIBNUMA_ROOT_DIR}" STREQUAL "" )
  find_path( LIBNUMA_INCLUDE_DIR numa.h  PATHS /usr/local/include )
  if( NOT "${LIBNUMA_INCLUDE_DIR}" STREQUAL "LIBNUMA_INCLUDE_DIR-NOTFOUND" )
    set( DETECTED_LIBNUMA_ROOT_DIR /usr/local )
  endif()
endif()
if( NOT "${DETECTED_LIBNUMA_ROOT_DIR}" STREQUAL "" )
  find_library(LIBNUMA_LIBRARY numa HINTS ${DETECTED_LIBNUMA_ROOT_DIR}/lib )
endif()
find_package_handle_standard_args(libnuma DEFAULT_MSG
  LIBNUMA_INCLUDE_DIR
  LIBNUMA_LIBRARY
)
if(LIBNUMA_FOUND)
set(
  LIBNUMA_LIBRARIES
  numa
)
set(LIBNUMA_LIBRARY_DIRS ${DETECTED_LIBNUMA_ROOT_DIR}/lib)
endif(LIBNUMA_FOUND)
mark_as_advanced(
  LIBNUMA_INCLUDE_DIR
  LIBNUMA_LIBRARIES
  LIBNUMA_LIBRARY_DIRS
  LIBNUMA_LIBRARY
)

