include_guard(GLOBAL)
include(verbose_message)
include(CheckSymbolExists)
check_symbol_exists("shm_open" "sys/mman.h" HAS_SHM)
if (NOT HAS_SHM)
    verbose_message("Looking for shm_open in librt")
    find_library(LIBRT_LIBRARIES rt)
    if(NOT LIBRT_LIBRARIES)
        message(FATAL_ERROR "librt not found")
    else()
        verbose_message("Found shm_open")
        set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${LIBRT_LIBRARIES}")
    endif()
else()
    verbose_message("Found shm_open in system header")
endif()
