set(WEBSOCKETS_SEARCH_PATHS
    /usr/local/
    /usr/
    /opt
)

find_path(WEBSOCKETS_INCLUDE_DIR libwebsockets.h
    HINTS
    PATH_SUFFIXES include
    PATHS ${SDL2_SEARCH_PATHS}
)

find_library(WEBSOCKETS_LIBRARY
    NAMES websockets
    HINTS
    PATH_SUFFIXES lib64 lib
    PATHS ${SDL2_SEARCH_PATHS}
)

if(WEBSOCKETS_INCLUDE_DIR AND WEBSOCKETS_LIBRARY)
   SET(WEBSOCKETS_FOUND TRUE)
endif()

if(WEBSOCKETS_FOUND)
    SET(WEBSOCKETS_LIBRARIES ${WEBSOCKETS_LIBRARY})
    SET(WEBSOCKETS_INCLUDE_DIRS ${WEBSOCKETS_INCLUDE_DIR})
    MESSAGE(STATUS "Found libWebsockets: ${WEBSOCKETS_LIBRARIES}")
else()
    MESSAGE(WARNING "Could not find libWebsockets")
endif()

mark_as_advanced(WEBSOCKETS_LIBRARY WEBSOCKETS_INCLUDE_DIR WEBSOCKETS_SEARCH_PATHS)
