function(common_build_ipk TARGET)    
    if (NOT DEFINED WEBOS_APPTITLE OR NOT DEFINED WEBOS_APPID)
        message(FATAL_ERROR "WEBOS_APPTITLE and WEBOS_APPID are not defined")
    endif()
    set(pkg_dir ${CMAKE_CURRENT_BINARY_DIR}/pkg_${TARGET})
    configure_file(${WEBOS_APPINFO} ${pkg_dir}/appinfo.json)
    install(TARGETS ${TARGET} DESTINATION ${pkg_dir})
    install(FILES ${WEBOS_APPICON} DESTINATION ${pkg_dir})
    install(CODE "execute_process(COMMAND ares-package ${pkg_dir})")
endfunction(common_build_ipk)