find_package(PkgConfig)
if(PKG_CONFIG_FOUND)
    pkg_check_modules(K8JSON k8json)
    set(K8JSON_LIBRARIES ${K8JSON_LDFLAGS})
endif()
if(NOT K8JSON_FOUND)
    message(STATUS "Using internal copy of k8json")
    set(K8JSON_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR} CACHE INTERNAL "")

    list(APPEND SRC "k8json/k8json.cpp")
    add_library(k8json STATIC ${SRC})
    target_link_libraries(k8json)
    qt_use_modules(k8json Core)
    update_compiler_flags(k8json)
    add_definitions(-DK8JSON_LIB_MAKEDLL -DK8JSON_INCLUDE_GENERATOR -DK8JSON_INCLUDE_COMPLEX_GENERATOR)
    set(K8JSON_LIBRARIES k8json CACHE INTERNAL "")
endif()
