INCLUDE(FindPackageHandleStandardArgs)

FIND_PACKAGE(PkgConfig)
PKG_CHECK_MODULES(PC_JANSSON QUIET jansson)

IF (NOT JANSSON_INCLUDE_DIR)
    FIND_PATH(JANSSON_INCLUDE_DIR jansson.h
        HINTS $ENV{JANSSON_DIR} ${PC_JANSSON_INCLUDEDIR} ${PC_JANSSON_INCLUDE_DIRS}
        PATH_SUFFIXES jansson
    )
ENDIF()
IF (NOT JANSSON_LIBRARIES)
    FIND_LIBRARY(JANSSON_LIBRARIES jansson HINTS $ENV{JANSSON_DIR})
ENDIF()

MARK_AS_ADVANCED(JANSSON_INCLUDE_DIR)
MARK_AS_ADVANCED(JANSSON_LIBRARIES)

FIND_PACKAGE_HANDLE_STANDARD_ARGS(
    Jansson
    DEFAULT_MSG
    JANSSON_LIBRARIES
    JANSSON_INCLUDE_DIR
)

